logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Mathew" <le...@sonata-software.com>
Subject Want to modify my existing log file name to include a dynamic variable value
Date Tue, 09 Feb 2010 07:08:35 GMT

Hi All,

I want to modify my existing log file name to include a dynamic variable
value.

Below is my log file.

<?xml version="1.0" encoding="utf-8" ?>
<log4net debug="false">

	<appender name="RollingLogFileAppender"
type="log4net.Appender.RollingFileAppender,log4net">
		<param name="File" value="logs\\intserver" />
		<param name="AppendToFile" value="true" />
		<param name="StaticLogFileName" value="False" />
		<param name="RollingStyle" value="Date" />
		<param name="DatePattern" value="'.'yyyy-MM-dd'.txt'" />
		<param name="RequestId" value="99" />

		<layout type="log4net.Layout.PatternLayout,log4net">
			<param name="ConversionPattern" value="%d [%t]
%-5p %c{1} - %m%n" />
		</layout>
	</appender>
	
	<root>
		<level value="DEBUG" />
		<appender-ref ref="RollingLogFileAppender" />
	</root>

</log4net>


Based on the above my existing or today's log file name is
intserver.2010-02-09.txt where 2010-02-09is today's date


I have a dynamic variable which I need to set in C#. In case the value
for my dynamic variable is 1000, my log file should be
intserver.2010-02-09.1000.txt

Does any one know how this can be done?

Regards,
Leo

Mime
View raw message