logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Eugeny_Vol...@Dell.com>
Subject Bug with IgnoresException
Date Fri, 02 Nov 2007 16:58:38 GMT
Hi,

I've tried to log Exception with next configuration

<configuration>

      <!-- Register a section handler for the log4net section -->

      <configSections>

    <section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />

  </configSections>

 

      

      <!-- This section contains the log4net configuration settings -->

      <log4net>         

    <appender name="LogFileAppender1"
type="log4net.Appender.FileAppender">

      <!-- File pattern to group files by date, then by session property
-->

      <!--file value="%date{yyyy-MM-dd}\%property{session}\output.log"
/-->

      <param name="File" value="c:\\log.txt" />

      <layout type="log4net.Layout.PatternLayout" value="%date [%thread]
%-5level %logger - %message%newline" />

      <filter type="log4net.Filter.LevelRangeFilter">

        <levelMin value="INFO" />

        <levelMax value="ERROR" />

      </filter>

    </appender>

 

    <appender name="LogFileAppender2"
type="log4net.Appender.FileAppender">

      <appendToFile value="true" />

      <file value="c:\\error-log.txt" />

      <encoding value="unicodeFFFE" />

      <layout type="log4net.Layout.PatternLayout">

        <conversionPattern value="%date [%thread] %-5level %logger -
%message %exception%newline" />

      </layout>

      <filter type="log4net.Filter.LevelRangeFilter">

        <levelMin value="ERROR" />

        <levelMax value="ERROR" />

      </filter>

    </appender>

 

    <!-- Setup the root category, add the appenders and set the default
level -->

            <root>

                  <level value="ALL" />

                  <appender-ref ref="LogFileAppender1" />

      <appender-ref ref="LogFileAppender2" />

    </root>

            

      </log4net>

</configuration>

 

By command 

// Log an error with an exception

log.Error("Exception thrown from method Bar", ex);

 

I'd like to get next:

*         In file log.txt next row

2007-11-02 19:40:47,427 [10] ERROR SampleAppendersApp.LoggingExample -
Exception thrown from method Bar

*         In file error-log.txt:

2007-11-02 19:40:47,427 [10] ERROR SampleAppendersApp.LoggingExample -
Exception thrown from method Bar System.ArithmeticException: Failed in
Goo. Calling Foo. Inner Exception provided ---> System.Exception: This
is an Exception

at SampleAppendersApp.LoggingExample.Foo() in c:\TFS\EMEA -
Shipping\GOAL\Prototypes\log4net-1.2.10\examples\net\1.0\Appenders\Sampl
eAppendersApp\cs\src\LoggingExample.cs:line 117

at SampleAppendersApp.LoggingExample.Goo() in c:\TFS\EMEA -
Shipping\GOAL\Prototypes\log4net-1.2.10\examples\net\1.0\Appenders\Sampl
eAppendersApp\cs\src\LoggingExample.cs:line 124

--- End of inner exception stack trace ---

at SampleAppendersApp.LoggingExample.Goo() in c:\TFS\EMEA -
Shipping\GOAL\Prototypes\log4net-1.2.10\examples\net\1.0\Appenders\Sampl
eAppendersApp\cs\src\LoggingExample.cs:line 128

at SampleAppendersApp.LoggingExample.Bar() in c:\TFS\EMEA -
Shipping\GOAL\Prototypes\log4net-1.2.10\examples\net\1.0\Appenders\Sampl
eAppendersApp\cs\src\LoggingExample.cs:line 112

at SampleAppendersApp.LoggingExample.Main(String[] args) in c:\TFS\EMEA
-
Shipping\GOAL\Prototypes\log4net-1.2.10\examples\net\1.0\Appenders\Sampl
eAppendersApp\cs\src\LoggingExample.cs:line 91

 

System.ArithmeticException: Failed in Goo. Calling Foo. Inner Exception
provided ---> System.Exception: This is an Exception

at SampleAppendersApp.LoggingExample.Foo() in c:\TFS\EMEA -
Shipping\GOAL\Prototypes\log4net-1.2.10\examples\net\1.0\Appenders\Sampl
eAppendersApp\cs\src\LoggingExample.cs:line 117

at SampleAppendersApp.LoggingExample.Goo() in c:\TFS\EMEA -
Shipping\GOAL\Prototypes\log4net-1.2.10\examples\net\1.0\Appenders\Sampl
eAppendersApp\cs\src\LoggingExample.cs:line 124

--- End of inner exception stack trace ---

at SampleAppendersApp.LoggingExample.Goo() in c:\TFS\EMEA -
Shipping\GOAL\Prototypes\log4net-1.2.10\examples\net\1.0\Appenders\Sampl
eAppendersApp\cs\src\LoggingExample.cs:line 128

at SampleAppendersApp.LoggingExample.Bar() in c:\TFS\EMEA -
Shipping\GOAL\Prototypes\log4net-1.2.10\examples\net\1.0\Appenders\Sampl
eAppendersApp\cs\src\LoggingExample.cs:line 112

at SampleAppendersApp.LoggingExample.Main(String[] args) in c:\TFS\EMEA
-
Shipping\GOAL\Prototypes\log4net-1.2.10\examples\net\1.0\Appenders\Sampl
eAppendersApp\cs\src\LoggingExample.cs:line 91

 

 

 

And found the issue in class(AppenderSkeleton) there is some typo(in
red) in method (RenderLoggingEvent)

if (!m_layout.IgnoresException)

 

 

 

Regards,

Eugeny Volkov

Dell EMEA Development & Architecture

( Office    +7 495 967-8030 ext.4332
* E-mail   mailto:eugeny_volkov@dell.com   

 

This communication is intended solely for the individual/entity to whom
it is addressed. It may contain confidential or legally privileged
information. Any unauthorized disclosure or copying is prohibited and
may be unlawful. If you have received this communication in error,
please notify the sender immediately and delete it from your system.

 

 


Mime
View raw message