-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Andreas,
On 6/9/2009 3:31 PM, Imner, Andreas wrote: > My companys web application uses log4j 1.2.8 for logging and have > just recently switched from Weblogic to Tomcat 6.0.18. > > Since the we switched to Tomcat, when we do some logging within a > servlet > > " private static final Log log = > LogFactory.getLog(ExceptionHandlerServlet.class); > log.error("some message", throwable); > " > > The "some message" -line is written to the file specified by log4j, > but why does the stacktrace gets written to Tomcats stdout.log? That depends on what else is going on in your servlet. If you let the exception propagate (by re-throwing it or throwing a new exception) and nobody else catches it, then Tomcat's request processing thread code will catch it and log it to stdout. > This is our log4j.properties file > > " > log4j.appender.A1=org.apache.log4j.RollingFileAppender > log4j.appender.A1.MaxBackupIndex=20 > log4j.appender.A1.MaxFileSize=10MB > > log4j.appender.A1.layout=org.apache.log4j.PatternLayout > > log4j.appender.A1.layout.ConversionPattern=%d{ABSOLUTE} %-5p %X{ak} [%c{1}] > %m%n > log4j.rootLogger=ERROR, A1 > > log4j.category.se=INFO > > # All System.out.println is redirected to stdout logger, INFO level > log4j.category.stdout=INFO > > # All System.err.println (includes Exception.printStackTrace() is redirected > to stderr logger, INFO level > log4j.category.stderr=INFO > " The code you provided does not show any use of the "stdout" category, but it doesn't really matter because the stdout category does not actually log to stdout :) Check to see that your code is not allowing exceptions to propagate. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkouvpkACgkQ9CaO5/Lv0PDwrACgsjUoqePn7xzDy5qVoBukKdOz iboAn2qKdOJxCDKQ+/mtp5vDnbv1v5ZN =AvA2 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org