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 azure_ss <se...@gmail.com> on 2006/07/26 19:28:08 UTC

log file for each session

I am learning log4net and want to know how can I config it to create log file
for each web session. say the log file name would be log{sessionid}.log

Can someone give some example?
Thanks

Victor
-- 
View this message in context: http://www.nabble.com/log-file-for-each-session-tf2005101.html#a5507552
Sent from the Log4net - Users forum at Nabble.com.


Re: log file for each session

Posted by azure_ss <se...@gmail.com>.
Ron,

I was considering two solutions the other days:
1. Create a new appender which can dispatch the log based on the sessionid
as I need.
2.  use the patternstring for the log filename, reload the configuration
file on each request
I tried the second one and it seems there some memory leak issue.
I am glad that the PatternFileAppender is already there. The thing left is
to check if it's threadsafe.
The new request you created would be really helpful and I am looking forward
to it.

Thanks.

Victor


Ron Grabowski wrote:
> 
> This post explains how to configure log4net to use a pattern for the
> File property of an appender that writes to a file.
> 
> http://tinyurl.com/p67at
> http://www.mail-archive.com/log4net-user%40logging.apache.org/msg03269.html
> 
> I created an issue and checked in some initial code for log4net to
> support accessing certain ASP.Net items:
> 
>  https://issues.apache.org/jira/browse/LOG4NET-87
> 
> Eventually, you'll be able to do something like this:
> 
>  <file value="%aspnet-session{sessionId}.log" />
> 
> Is this an ok naming convention?
> 
>  %aspnet-session{contents:key=ProductId}
>  %aspnet-session{contents:count}
>  %aspnet-session{sessionId}
>  %aspnet-request{items:key=ProductId}
>  %aspnet-request{queryString:key=ProductId}
>  %aspnet-request{queryString:count} 
> 
> --- azure_ss <se...@gmail.com> wrote:
> 
>> 
>> I am learning log4net and want to know how can I config it to create
>> log file
>> for each web session. say the log file name would be
>> log{sessionid}.log
>> 
>> Can someone give some example?
>> Thanks
>> 
>> Victor
>> -- 
>> View this message in context:
>>
> http://www.nabble.com/log-file-for-each-session-tf2005101.html#a5507552
>> Sent from the Log4net - Users forum at Nabble.com.
>> 
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/log-file-for-each-session-tf2005101.html#a5540588
Sent from the Log4net - Users forum at Nabble.com.


Re: log file for each session

Posted by Ron Grabowski <ro...@yahoo.com>.
This post explains how to configure log4net to use a pattern for the
File property of an appender that writes to a file.

http://tinyurl.com/p67at
http://www.mail-archive.com/log4net-user%40logging.apache.org/msg03269.html

I created an issue and checked in some initial code for log4net to
support accessing certain ASP.Net items:

 https://issues.apache.org/jira/browse/LOG4NET-87

Eventually, you'll be able to do something like this:

 <file value="%aspnet-session{sessionId}.log" />

Is this an ok naming convention?

 %aspnet-session{contents:key=ProductId}
 %aspnet-session{contents:count}
 %aspnet-session{sessionId}
 %aspnet-request{items:key=ProductId}
 %aspnet-request{queryString:key=ProductId}
 %aspnet-request{queryString:count} 

--- azure_ss <se...@gmail.com> wrote:

> 
> I am learning log4net and want to know how can I config it to create
> log file
> for each web session. say the log file name would be
> log{sessionid}.log
> 
> Can someone give some example?
> Thanks
> 
> Victor
> -- 
> View this message in context:
>
http://www.nabble.com/log-file-for-each-session-tf2005101.html#a5507552
> Sent from the Log4net - Users forum at Nabble.com.
> 
>