A possibility to have different logger universes in one JVM instance I have 
described last week. See Thread "Use different log files inside one program".

Applying this solution you can achieve your wished <clientID> within the 
filename. 

The problem of the daily log is solved at best with DailyRollingFileAppender. 
But: Placing the date before the extension is not yet supported by log4j 
(actual productive release). Currently the DailyRollingFileAppender works like 
this: the actual log file has not date, when the file rolls over, the date is 
appended to the file name like: <filename>.<ext><datepattern>. I think next 
release will have improved possibilities for defining file name patterns. If 
your desired pattern (date before extension) is a must for you, you have to 
write your own DailyRollingFileAppender.

Heri

> -----Original Message-----
> From: Christian Rosenberger [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 27, 2006 3:02 PM
> To: log4j-user@logging.apache.org
> Subject: Single logfile per User and Day
> 
> 
> Hi all,
> 
> I've a requirement for logging with log4j for each userID and day to a
> single file.
> 
> The userID is provided as a parameter to the constructor of 
> the first class
> of my application.
> 
> the logfilename should look like this:
> 
> applicationlog.<clientID>.<currentdate>.log
> 
> How can that be achived with log4J?
> 
> I've seen a posting which shows the usage of MDC to let me 
> log the userID
> within the logfile, e.g.  "TIMESTAMP [USERID] - Output of 
> Log". But that
> means a real huge logfile per day. The number of clientIDs 
> are restricted to
> 100, so I've 100 logfiles per day at max.
> 
> Is it possible to include some parameters out of the MDC as a 
> filename? To
> set the system properties isn't really an option, as each 
> user thread would
> override the others.
> 
> The problem with a custom appender is, that I would have to 
> specify the
> userID in each class constructor I'm using.
> 
> Any idea? 
> 
> Thanks in advance.
> 
> Regards,
> Christian
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to