how to make log4net exclude Stack Trace

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to make log4net exclude Stack Trace

emacslisp
By default, log4net will log Stack Trace.

I create a wraper which inherit from "ILog" and implement "ILog" interface directly.

public class MyLogger : ILog
{
    ...
    Error(object message, Exception exception)
    {
        log.Error(exception.Message);//Now it will show message only.
    }
    ...
}

then log4net.ILog log = new MyLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

it could work.

However, I want to config log4net without logging stack trace.

but I could not find any useful information.
Reply | Threaded
Open this post in threaded view
|

Re: how to make log4net exclude Stack Trace

rmashal
1. Did you see this: http://stackoverflow.com/questions/3659271/log4net-logging-out-the-exception-stacktrace-only-for-certain-files/3660529#3660529 ?
It seems to have a configuration solution for your problem.

2. I used extension methods to enhance a logging system a bit. No need to create a new implementation of ILog.

Ronen.


On Mon, Feb 9, 2015 at 3:53 AM, emacslisp <[hidden email]> wrote:
By default, log4net will log Stack Trace.

I create a wraper which inherit from "ILog" and implement "ILog" interface
directly.

public class MyLogger : ILog
{
    ...
    Error(object message, Exception exception)
    {
        log.Error(exception.Message);//Now it will show message only.
    }
    ...
}

then log4net.ILog log = new
MyLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

it could work.

However, I want to config log4net without logging stack trace.

but I could not find any useful information.



--
View this message in context: http://apache-logging.6191.n7.nabble.com/how-to-make-log4net-exclude-Stack-Trace-tp53708.html
Sent from the Log4net - Users mailing list archive at Nabble.com.



--

 

email_sig
Ronen Mashal

Software Engineer | Magic Software Enterprises Ltd.

Tel. +972-3-5389215       |       Fax. +972-3-5389333
[hidden email] | www.magicsoftware.com | FacebookTwitterLinkedinYouTubeGoogle+Magic Software Blog

 



DISCLAIMER. Information in this message and its attachments may be privileged or confidential. It is for the exclusive use of the intended recipient(s). 
If you are not one of the intended recipients, you are hereby informed that any use, disclosure, distribution, and/or copying of this information is strictly prohibited. 
If you receive this message in error, please notify the sender immediately and delete all copies of this message. We recommend that you scan your incoming Emails. 
We cannot accept responsibility for any transmitted viruses.