Hi,
I'm using log4net-1.2.10 with .NET 2.0 to develop a Windows (Forms) application.
I have added two file appenders (one for Debug & above; the other for
Info & above). The settings for these are specified in my app.config
file.
Everything was working fine, until I needed to add a reference to
another assembly (dll) developed by a colleague. This assembly also
uses log4net for logging, the settings for which are defined in the
assembly's own config file.
Now, what I would ideally want is for the assembly to log its messages
in another file and my app's messages to go in another set of files.
However, what I see is that messages from my app are also logged in
the assembly's log file. (They are also logged in the app's log
files).
I think thats the way it will work according to the settings
specified; but I wanted to know if there is a way to segregate the log
messages from the assembly & main app into different files.
Here are the log4net settings for the application (from the
application's config file):
<log4net>
<appender name="File_Info" type="log4net.Appender.FileAppender">
<file value="logs//App_Info.log" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%-5level] %C.%M -
%message%newline" />
</layout>
<threshold value="INFO"/>
</appender>
<appender name="File_Debug"
type="log4net.Appender.FileAppender">
<file value="logs//App_Debug.log" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%-5level] %C.%M -
%message%newline" />
</layout>
<threshold value="DEBUG"/>
<!-- filter type="log4net.Filter.DenyAllFilter"/ -->
</appender>
<root>
<level value="ALL" />
<appender-ref ref="File_Info" />
<appender-ref ref="File_Debug" />
</root>
</log4net>
------------------------------
Here are the settings for the assembly (from its config file):
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<param name="File" value="logs//Assembly.log" />
<param name="AppendToFile" value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
</layout>
</appender>
<root>
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
---------------------------------
Any help is appreciated.
Thanks,
MadMonk