Hi,

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,
ConsoleAppender.SYSTEM_OUT));
      logger.setLevel(Level.DEBUG);
      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 ?

Thx


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

Reply via email to