logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mad Monk" <monk...@gmail.com>
Subject Using different log files for different assemblies
Date Tue, 31 Oct 2006 14:29:20 GMT

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

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

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):

		<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" />
			<threshold value="INFO"/>
		<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" />
			<threshold value="DEBUG"/>
			<!-- filter type="log4net.Filter.DenyAllFilter"/ -->
			<level value="ALL" />
			<appender-ref ref="File_Info" />
			<appender-ref ref="File_Debug" />

Here are the settings for the assembly (from its config file):

        <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" />

            <appender-ref ref="LogFileAppender" />

Any help is appreciated.


View raw message