Hello,

Need help on configuring log4j.

Let's say, we have following logger :

Java Code:
Logger a = Logger.getLogger("a");
and this log4j configuration file :

log4j.rootLogger=ERROR, stdout
log4j.category.a=TRACE, a

##### STDOUT
log4j.appender.stdout=org.apache.log4j.ConsoleAppe nder
log4j.appender.stdout.layout=org.apache.log4j.Patt ernLayout
log4j.appender.stdout.layout.ConversionPattern=%-5p [%d{dd MM yyyy HH:mm:ss.SSS}] %l - %m%n

##### a
log4j.appender.a=org.apache.log4j.DailyRollingFile Appender
log4j.appender.a.File=c:\\logs\\a.log
log4j.appender.a.layout=org.apache.log4j.PatternLa yout
log4j.appender.a.layout.ConversionPattern=%-5p [%d{dd MM yyyy HH:mm:ss.SSS}] %l - %m%n
log4j.appender.a.DatePattern='.'yyyy-MM-dd
log4j.appender.a.ImmediateFlush=true
The test code looks like this :
a.debug("debugA");
a.error("errorA");
I see both of these lines in the file created AND in stdout :
Java Code:
DEBUG [15 07 2010 13:53:24.245] log4jtest.Test1.main(Test1.java:12) - debugA
ERROR [15 07 2010 13:53:24.250] log4jtest.Test1.main(Test1.java:13) - errorA
But I don't want this line :

Java Code:
DEBUG [15 07 2010 13:53:24.245] log4jtest.Test1.main(Test1.java:12) - debugA
to appear in stdout.

What I want is, I've several categories, each logging to different files.
But when an error occurs, I want the stacktrace to appear in the stdout file (SystemOut.log) as well.

Is there a way of accomplishing this WITHOUT writing code looking similar to this :
Java Code:
... } catch (... e) {
      Logger log = Logger.getLogger("a");
      log.error(e);
      log = Logger.getRootLogger();
      log.error(e);
}
Is there a way to establish this through the configuration file ?