Put this line in the beginning of your log4j.xm/properties file:
log4j.debug=true
(I have never used the .xml file, so I'm not sure what you analogical statement you would put in there).
This will run log4j on log4j :-)
All log4j debug messages will show up on the root logger, which I think is stdout.
HTHs, Karan
shirish wrote:
While setting the values for the variables defined in log4j.xml , if some
error is encountered , where do we log this exception as the log4j has not
been cpnfigured so far.?
I am using System.err.println statements , can log4j be configured to log these statements
Regards, Shirish
----- Original Message ----- From: "Ceki G lc " <[EMAIL PROTECTED]> To: "Log4J Users List" <[email protected]> Sent: Thursday, November 25, 2004 2:30 PM Subject: RE: smart file name
Yair,
Are you calling PropertiesConfigurator, DOMConfigrator, JoranConfigrator yourself? If you are, you can fill in the value of the variable before invoking the configurator.
To give you an idea, assume you use PropertiesConfigurator.
Properties props = new Properties(); FileInputStream istream = new FileInputStream("/your/config/file.properties"); props.load(istream); istream.close()
// set the value of "now" to a string formatted according to your // liking SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-ss"); props.setProperty("now", sdf.format(new Date());
// now configure log4j new PropertiesConfigurator().doConfigure(props, LogManager.getLogggingRepository());
Your config file in properties format would look like
log4j.rootLogger=debug, KUKU log4j.appender.KUKU=org.apache.log4j.FileAppender log4j.appender.KUKU.File=/wombat/kuku-${now}.log etc...
I'd like to note that the choice of using "kuku" as a file name was yours,
certainly not mine. :-)
HTH,
At 06:43 AM 11/25/2004, Yair Ogen wrote:
I've thiught about it, but when is try to put a variable on the file name
it is ignored. Please note I'm looking for a static decleration in my
config file that will get a dynamic value every time the file is created.
i.e. fileName="cat_{d}.log" or something like that.
-- Ceki G lc
The complete log4j manual: http://qos.ch/eclm Professional log4j support: http://qos.ch/log4jSupport
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
.
-- CM II Resolution Systems Inc. /-- never compromise. what if you compromise and lose? --/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
