You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Ju...@chasecredit.com on 2004/05/06 16:59:44 UTC

RE: RollingFileAppender File Extension/Date Format

Thanks for your solution. Here is my appender and the results:

<appender name="MainLog" type="log4net.Appender.RollingFileAppender">
	<file value="Main.log" />
	<appendToFile value="true" />
	<datePattern value=".yyyyMMdd.log" />
	<rollingStyle value="Date" />
	<param name="StaticLogFileName" value="false" />
	<layout type="log4net.Layout.PatternLayout">
		<conversionPattern value="%d %-8ndc %-5thread %-5level
%logger %message %timestampms %n" />
	</layout>
</appender>

Which results in:
Main.log.20040430.loA.D

If I use <datePattern value=".yyyyMMdd.txt" /> the file name becomes this:
Main.log.20040430.AxA

Is there some sort of string replacement going on?

- Julian


-----Original Message-----
From: Lansdaal, Michael T [mailto:michael.t.lansdaal@boeing.com]
Sent: Thursday, April 29, 2004 3:01 PM
To: Julian_Sitkewich@chasecredit.com; log4net-user@logging.apache.org
Subject: RE: RollingFileAppender File Extension/Date Format


Julian - Yes, its possible.  I have a log file name format of
"debug.2004-04-26.log".  You can set this with the appender in the
config file, although, I don't think how I'm using it is quite what was
envisioned.

Here's my appender:

		<appender name="RollingLogFileAppender"
type="log4net.Appender.RollingFileAppender">
			<param name="File" value="..\\Data\\Logs\\debug"
/>
			<param name="AppendToFile" value="true" />
			<param name="MaxSizeRollBackups" value="10" />
			<param name="MaximumFileSize" value="100000" />
			<param name="RollingStyle" value="Composite" />
			<param name="StaticLogFileName" value="false" />
			<param name="DatePattern"
value=".yyyy-MM-dd.lo\\g" />
			<layout type="log4net.Layout.PatternLayout">
				<param name="Header" value="[BEGIN_LOG
=========================]\r\n" />
				<param name="Footer" value="[END_LOG
=========================]\r\n\r\n" />
				<param name="ConversionPattern"
value="%d [%t] %-5p %c [%x] - %m%n" />
			</layout>
		</appender>

Thanks, Mike Lansdaal

-----Original Message-----
From: Julian_Sitkewich@chasecredit.com
[mailto:Julian_Sitkewich@chasecredit.com] 
Sent: Thursday, April 29, 2004 2:20 PM
To: log4net-user@logging.apache.org
Subject: RollingFileAppender File Extension/Date Format


I'm not sure if this is possible with log4net, but I would like to
change RollingFileAppender so the date file suffix is something other
than the '.log' followed by the formatted date. Maybe something like
this:

LoggerFileName.YYYYMMdd.log

- or -

YYYYMMdd.LoggerFileName.log

Thanks...