You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by Rob1234 <ro...@lloydstsb.co.uk> on 2008/11/28 14:54:40 UTC
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.
Re: Create new log file each time application is started
Posted by NeerajG <ne...@citi.com>.
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 <ro...@lloydstsb.co.uk>
>> To: log4net-dev@logging.apache.org
>> 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.
Re: Create new log file each time application is started
Posted by Rob1234 <ro...@lloydstsb.co.uk>.
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 <ro...@lloydstsb.co.uk>
> To: log4net-dev@logging.apache.org
> 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-tp20734792p20774311.html
Sent from the Log4net - Dev mailing list archive at Nabble.com.
Re: Create new log file each time application is started
Posted by Ron Grabowski <ro...@yahoo.com>.
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 <ro...@lloydstsb.co.uk>
To: log4net-dev@logging.apache.org
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.