tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomcat Random <tomcat.ran...@gmail.com>
Subject Re: Logging makes a grown man cry
Date Mon, 23 Dec 2013 21:15:44 GMT
Sorry if resurrecting the dead is frowned upon here but I thought I would
just add my resolve to this. Honestly, after writing a lot of code
otherwise, logging was probably the most frustrating.

Tomcat 7.0.42, RHEL 6

1. SL4FJ with Logback works beautifully.

2. I have custom error pages in web.xml that redirect various exceptions to
servlets. The servlets capture the exceptions and write them out to
different logs using SLF/Logback.

3. The default logging.properties is completely commented out. Note:
deleting it is different than it being empty.

4. Since spymemcached logging is baked in, I added SLF as its logger in my
ContextInitialized listener:

 // set SLF4J as the logger for spymemcached
 Properties systemProperties = System.getProperties();
systemProperties.put("net.spy.log.LoggerImpl",
"net.spy.memcached.compat.log.SLF4JLogger");
System.setProperties(systemProperties);

ch.qos.logback.classic.Logger logger =
         (ch.qos.logback.classic.Logger)
LoggerFactory.getLogger("net.spy.memcached");

logger.setLevel(Level.ERROR);


Cheers,
Alec

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message