You could put %processid as shown below.

<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
    <file type="log4net.Util.PatternString"
value="log-file-[%processid].txt" />
    <layout type="log4net.Layout.PatternLayout" value="%date [%thread]
%-5level %logger - %message%newline" />
</appender>



Rob1234 wrote:
> 
> 
> Do you have any idea how I go about doing that? I can't find any
> configuration options which let you pass in a parameter to the file name.
> 
> Rob
> 
> 
> Ron Grabowski wrote:
>> 
>> You'd have to do something like include the process id (or other unique
>> identifier) in the file name for each instance.
>> 
>> 
>> 
>> ----- Original Message ----
>> From: Rob1234 <[email protected]>
>> To: [email protected]
>> Sent: Friday, November 28, 2008 8:54:40 AM
>> Subject: Create new log file each time application is started
>> 
>> 
>> Hi
>> 
>> I have a problem with log4net. I have an application which uses a
>> RollingFileAppender. The applcation can be started multiple times from
>> the
>> same location. I want there to be a seperate log file each time the
>> application is started. e.g. 5 apps running = 5 log files. Is there any
>> way
>> to do this in log4net?
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Create-new-log-file-each-time-application-is-started-tp20734792p20734792.html
>> Sent from the Log4net - Dev mailing list archive at Nabble.com.
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Create-new-log-file-each-time-application-is-started-tp20734792p21803201.html
Sent from the Log4net - Dev mailing list archive at Nabble.com.

Reply via email to