logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "i314523@addcom.de" <i314...@addcom.de>
Subject Multiple entries for one message in Logfile
Date Thu, 26 Apr 2007 14:00:55 GMT
Hi all,
I'm new to log4J and think that I have a configuration problem. But 
let me explain a little. I'm using Weblogic server 8.1. In my EAR I put 
a central Debug class, which collects all Debug messages and prints it 
to a logfile. I don't understand why I have the Logger class in each of 
my files. This is what I've done:

public class Debug {
    private static Logger logger = Logger.getLogger("com.tsystems.
spring.lion");

    public static void init() throws IOException {
//   the following is only for testing purposes, I don't have a config 
file yet
    try {
            Layout layout = new PatternLayout("%d [%t] %p - %m%n");
            FileAppender appender= new FileAppender(layout, logDir + 
"/" + baseName + ".log");
            logger.addAppender(appender);
     } catch (java.io.IOException e) {}
}

    public static void log(String message) {
        logger.debug(message);
   }
}

public class Foo {
... some code ...
Debug.log("This is a debug message");
}

The proble is that the log message appears *multiple* (3 to 4 times) 
in my logfile. Same timestamp, same message. Now my question: What have 
I to configure that the output only appears once? Where should I place 
the initialization file (config file) for log4j that it could be found?

TIA,
Ralf.


Jetzt neu: Der Routenplaner von Tiscali
http://www.tiscali.de/trav/routenplaner.html


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message