This is interesting that you say it is not supported. My configuration looks
like this:
<appender name="DateSeparatedLogFileAppender"
type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="C:\temp\logs\%processid_"
/>
<staticLogFileName value="false"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'_MyApplication.log'"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern"
value="%date [%-5thread] %-5level %-35username -
%message%newline%exception"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="DEBUG"/>
<levelMax value="FATAL"/>
</filter>
</appender>
And I am getting a separate file for each execution of the program:
3268_20130724_MyApplication.log
5844_20130724_MyApplication.log
10460_20130724_MyApplication.log
I tried some tricks to get the date component first for easier sorting, but no
luck.
Peter
From: Dominik Psenner [mailto:[email protected]]
Sent: Wednesday, July 24, 2013 10:54 AM
To: 'Log4NET Dev'
Subject: AW: File naming
Hi,
try different configurations for each instance. Unfortunately currently there's
no way to configure the rolling file appender so that it encodes the process id
in the filename. Feel free to open an issue if the "multiple
configurations"-workaround is not a solution for you. Please consider also when
creating a new issue to link it with issue LOG4NET-367 so that whoever's going
to work on LOG4NET-367 will consider your usecase.
Cheers,
Dominik
Von: Howe, Peter L [mailto:[email protected]]
Gesendet: Mittwoch, 24. Juli 2013 16:17
An: Log4NET Dev
Betreff: File naming
HI,
I need a little help figuring out to write the app.config file syntax for
including the process ID in the file name. Our company needs to make sure that
multiple instances of the same app running on the server use separate log
files. We want a filename something like:
yyyymmdd_ProcessID_OurApplication.log
If anyone can help with the syntax, that would be great. I have looked around
the apache site at documentation and done some "trial and error" testing, but
so far only failures...
Thanks,
Peter
The information contained in this message may be privileged, confidential and
protected from disclosure. If the reader of this message is not the intended
recipient, or an employee or agent responsible for delivering this message to
the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify your representative
immediately and delete this message from your computer. Thank you.