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

Reply via email to