logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S├ębastien Hiblot <sebastien.hib...@atosorigin.com>
Subject Help !
Date Thu, 16 Jan 2003 13:22:03 GMT

We're working on a java web site and we'd like to use log4j in order
to log the error.

We have made a class to implement the init of log4j. Here the source of this
class :

private Logger logger ;

public Trace(String class_name) {
	logger = LogManager.getLogger(class_name);
      Layout layout = new PatternLayout("%d{yyyyMMdd-HH:mm:ss} %m%n");
      logger.addAppender(new ConsoleAppender(layout,
      try {
      	logger.addAppender(new FileAppender(layout, (String)
Ecx_constants.getInstance().get("log4j_fileTrace"), true));
      } catch (IOException e) {

To log something :
Trace t = new Trace(this.getClass().toString()) ;
t.debug("My message");

The first time, we call the page, the log contain the good thing :
20030116-12:00:00 My message

But the second time we call the page, 30 sec after, we have in the log:
20030116-12:00:00 My message
20030116-12:00:30 My message
20030116-12:00:30 My message

==> the log appears 2 times !
the third time, the log appears 3 time, etc......

Can you help us please ?


To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

View raw message