logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chetan.v.minaj...@jpmchase.com
Subject log4j -log file naming
Date Tue, 09 May 2006 16:18:30 GMT
Hi,

I am using log4j.I have created a wrapper factory around log4j so that 
each module in my application gets a reference to its own logger(with own 
destination,pattern/formatting etc).

Now the problem,
I have threads running in my module.The no of threads are configurable(by 
tweaking an xml file).

What I need is,each of this thread to log into a log file something like ,
threadId_logFileName.log.
I saw that I ca use a property name something like
filePrefix=threadId

and then use it like this,
log4j.appender.dest4.File=C:/logs/Predict/text/${filePrefix}Predict.log

but when the number of threads is itself configurable then in that case 
what do i do.
I don't think to hard code serveral properties like 
filePrefix1,filePrefix2 etc for the threads that i amgoing to have is the 
right way.

Can somebody help me how to do it.Or is there by any chance at runtime I 
can add the prefix,create a new file and continue logging.

Pls suggest some way of achieving this.

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