logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milad Ershaghi" <mersha...@esri.com>
Subject Possible To Name Log File After Assembly?
Date Tue, 07 Nov 2006 02:29:58 GMT
Dear Community,

I was wondering if it is possible to name a log file after an assembly
via the config file. Here is my config file:

--

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<configSections>
		<section name="log4net"
type="System.Configuration.IgnoreSectionHandler"/>
	</configSections>
	<log4net>
		<root>
			<level value="ALL"/>
			<appender-ref ref="LogFileAppender"/>
		</root>
		<appender name="LogFileAppender"
type="log4net.Appender.FileAppender">
			<threshold value="ALL"/>
			<file value="log4net.log"/>
			<appendToFile value="false"/>
			<immediateFlush value="true"/>
			<lockingModel
type="log4net.Appender.FileAppender+ExclusiveLock" />
			<layout type="log4net.Layout.PatternLayout">
				<header value="[Start of
Execution]&#13;&#10;"/>
				<footer value="[End of
Execution]&#13;&#10;"/>
				<conversionPattern value="%date
[%thread] %-5level %logger [%property{NDC}] - %message%newline"/>
			</layout>
		</appender>
  </log4net>
</configuration>

--

Would it be possible to replace "log4net.log" with some other parameter
that would refer to the assembly name say in braces and then add on a
file extension. For example:

<file value="{AssemblyName}.log"/>

Or is there some other way to accomplish this?

Thanks

Sincerely,

Milad

Mime
View raw message