Conigure log4net for .net dll

View: New views
5 Messages — Rating Filter:   Alert me  

Conigure log4net for .net dll

by Debashish :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi
I am developing a ClassLibrary in C#(VS2008).
I have refernce to log4net.dll.
This DLL has only one function which will log a
string using log4net.
My AssemblyInfo.cs has the following entry:
[assembly: log4net.Config.XmlConfigurator()]
I use this above dll in a WINForms application.

The problem is log4net is not logging any information.

Appreciate help.

Parent Message unknown Re: Conigure log4net for .net dll

by Ron Grabowski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Have you verified that your App.Config configures log4net correctly? What happens when you turn on log4net's internal debugging?



----- Original Message ----
From: Debashish <debashish_de@...>
To: log4net-user@...
Sent: Wednesday, August 13, 2008 3:43:22 PM
Subject: Conigure log4net for .net dll


Hi
I am developing a ClassLibrary in C#(VS2008).
I have refernce to log4net.dll.
This DLL has only one function which will log a
string using log4net.
My AssemblyInfo.cs has the following entry:
[assembly: log4net.Config.XmlConfigurator()]
I use this above dll in a WINForms application.

The problem is log4net is not logging any information.

Appreciate help.

--
View this message in context: http://www.nabble.com/Conigure-log4net-for-.net-dll-tp18969861p18969861.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Re: Conigure log4net for .net dll

by Debashish :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi,

This is what i ahve in app.config,  please correct me if i am wrong.

<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>
  <log4net>
    <appender name="Class1" type="log4net.Appender.RollingFileAppender">
      <file value="c:\\Log4net.txt" />
      <appenderToFile value="true"></appenderToFile>
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%d [%t] %-5p %c - %m%n" />
      </layout>
    </appender>
    <logger name="ClassLibrary1">
      <level value="DEBUG" />
      <maximumFileSize value="256KB" />
     
      <appender-ref ref="application" />
    </logger>
    <root>
      <level value="DEBUG">
        <appender-ref ref="Class1"></appender-ref>
      </level>
    </root>
  </log4net>

</configuration>

Thanks
Debashish wrote:
Hi
I am developing a ClassLibrary in C#(VS2008).
I have refernce to log4net.dll.
This DLL has only one function which will log a
string using log4net.
My AssemblyInfo.cs has the following entry:
[assembly: log4net.Config.XmlConfigurator()]
I use this above dll in a WINForms application.

The problem is log4net is not logging any information.

Appreciate help.

Re: Conigure log4net for .net dll

by Daniel Williams-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dude,

You can diagnose this issue by turning on the log4net internal
debugging.  Do this by putting the following into the app.config file
of your Main app:

<configuration>
    <appSettings>
        <add key="log4net.Internal.Debug" value="true"/>
    </appSettings>
</configuration>

Next, you will want to catch the messages that log4net writes.  You
can do this in your app.config file as well.  Put in a section like
this:

<system.diagnostics>
   <trace autoflush="true">
     <listeners>
       <add name="textWriterTraceListener"
            type="System.Diagnostics.TextWriterTraceListener"
            initializeData="C:\temp\log4net_internal.log"/>
     </listeners>
   </trace>
 </system.diagnostics>

This will take the output of log4net and put it into a simple log
file.  Then you should be able to see just what it is that log4net is
getting stuck on.

Cheers,
Daniel  Williams

On Wed, Aug 13, 2008 at 3:35 PM, Debashish <debashish_de@...> wrote:

>
> hi,
>
> This is what i ahve in app.config,  please correct me if i am wrong.
>
> <configuration>
>  <configSections>
>    <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
>  </configSections>
>  <log4net>
>    <appender name="Class1" type="log4net.Appender.RollingFileAppender">
>      <file value="c:\\Log4net.txt" />
>      <appenderToFile value="true"></appenderToFile>
>      <layout type="log4net.Layout.PatternLayout">
>        <conversionPattern value="%d [%t] %-5p %c - %m%n" />
>      </layout>
>    </appender>
>    <logger name="ClassLibrary1">
>      <level value="DEBUG" />
>      <maximumFileSize value="256KB" />
>
>      <appender-ref ref="application" />
>    </logger>
>    <root>
>      <level value="DEBUG">
>        <appender-ref ref="Class1"></appender-ref>
>      </level>
>    </root>
>  </log4net>
>
> </configuration>
>
> Thanks
>
> Debashish wrote:
>>
>> Hi
>> I am developing a ClassLibrary in C#(VS2008).
>> I have refernce to log4net.dll.
>> This DLL has only one function which will log a
>> string using log4net.
>> My AssemblyInfo.cs has the following entry:
>> [assembly: log4net.Config.XmlConfigurator()]
>> I use this above dll in a WINForms application.
>>
>> The problem is log4net is not logging any information.
>>
>> Appreciate help.
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Conigure-log4net-for-.net-dll-tp18969861p18971678.html
> Sent from the Log4net - Users mailing list archive at Nabble.com.
>
>

Re: Conigure log4net for .net dll

by Freddy Gómez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Debashish,

The logger named 'ClassLibrary1' references to an appender called 'application' which doesn't exist in the configuration file, this is an invalid reference that will throw and exception internally in the log4net assembly.

You can read debugging output from log4net by adding these key to your application cofiguration file:

<appSettings>
<add key="log4net.Internal.Debug" value="true"/>
<add key=""log4net.Internal.Quiet" value="false"/>
</appSettings>

Also, remember to call XmlConfiguration.Configure()

fred.



On Wed, Aug 13, 2008 at 5:05 PM, Debashish <debashish_de@...> wrote:

hi,

This is what i ahve in app.config,  please correct me if i am wrong.

<configuration>
 <configSections>
   <section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
 </configSections>
 <log4net>
   <appender name="Class1" type="log4net.Appender.RollingFileAppender">
     <file value="c:\\Log4net.txt" />
     <appenderToFile value="true"></appenderToFile>
     <layout type="log4net.Layout.PatternLayout">
       <conversionPattern value="%d [%t] %-5p %c - %m%n" />
     </layout>
   </appender>
   <logger name="ClassLibrary1">
     <level value="DEBUG" />
     <maximumFileSize value="256KB" />

     <appender-ref ref="application" />
   </logger>
   <root>
     <level value="DEBUG">
       <appender-ref ref="Class1"></appender-ref>
     </level>
   </root>
 </log4net>

</configuration>

Thanks

Debashish wrote:
>
> Hi
> I am developing a ClassLibrary in C#(VS2008).
> I have refernce to log4net.dll.
> This DLL has only one function which will log a
> string using log4net.
> My AssemblyInfo.cs has the following entry:
> [assembly: log4net.Config.XmlConfigurator()]
> I use this above dll in a WINForms application.
>
> The problem is log4net is not logging any information.
>
> Appreciate help.
>
>

--
View this message in context: http://www.nabble.com/Conigure-log4net-for-.net-dll-tp18969861p18971678.html
Sent from the Log4net - Users mailing list archive at Nabble.com.