logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Fuerholz <Peter.Fuerh...@ascom.ch>
Subject Re: AW: Usage of EnhanedPatternLayout
Date Tue, 11 May 2010 07:46:06 GMT
Hi Scott,

thanks for your response. I was unsure, if Log4j already had a solution 
for the problem mentioned. As it seems there is no boilerplate solution 
available. 
What I could do is configuring a filename like this 

<param name="File" value="logfile${sessionId}.log" />

Before starting Log4j I could set the 'sessionId'-property (via 
System.setProperty("sessionId", <id>)) with the current session-id from 
the client-server-communication. I tried that and it works basically. 
I currently use a RollingFileAppender with constrained file sizes and 
backup indexes. The problem is now, that each program run adds a new set 
of log file and inflates the total amount of log data. Example:
logfile15.log, logfile15.log.1, logfile15.log.2
logfile34.log, logfile34.log.1, logfile34.log.2
logfile62.log, logfile62.log.1, logfile62.log.2

Depending on the range of session-ids the logged data get almost never 
deleted at all...  ;-(

Instead of using a session-id I am thinking about finding a way to count 
the currently run program instances...

Thanks,
Peter




Scott Deboy <scott.deboy@gmail.com> wrote on 10.05.2010 19:55:34:

> [image removed] 
> 
> ----- Message from Scott Deboy <scott.deboy@gmail.com> on Thu, 6 May
> 2010 11:50:16 -0700 -----
> 
> To:
> 
> Log4J Users List <log4j-user@logging.apache.org>
> 
> Subject:
> 
> Re: Logging multiple Webstart client instances?
> 
> In a prior life I used a subclass of RollingFileAppender which set the 
file
> name to include hours, minutes and seconds, but rolled based on size..I
> think if a filenamepattern was supported for the activeFileName in
> TimeBasedRollingPolicy, this would solve your problem...
> 
> Scott
> 
> On Tue, May 4, 2010 at 2:47 AM, Peter Fuerholz 
<Peter.Fuerholz@ascom.ch>wrote:
> 
> > Hi there,
> >
> > I have a signed WebStart application which logs defaultly into the 
current
> > user's home directory. (If I use a relative path the log file is saved
> > under a browser specific path which is not very user friendly.) There 
are
> > now cases where it is sensible to start this WebStart application 
twice or
> > more times. In this case, all program instances write to the same log 
file
> > which makes it very difficult to read.
> >
> > I came up with following two solutions:
> > - Put each log file into a session-specific path, e.g.
> >  <home>/.<application-name>/<session-id>/<filename>
> >  session-id must be a program instance specific identifier
> > - Use MDC. Distinguish the different client instances by using 
different
> > MDC-keys.
> >  - This could be a problem using RollingFileAppender (Messages may get
> > messed up according older mailing list entries?)
> >  - Produces a lot of extra data since the cases, where > 1 program
> > instances are running, are rather few
> >
> > Is there a default behaviour how to solve this issue?
> > Any help appreciated.
> >
> > Yours,
> > Peter
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message