15 Jul 17:53
RE: JDBCAppender configuration
From: Michael Erskine <michael.erskine <at> ketech.com>
Subject: RE: JDBCAppender configuration
Newsgroups: gmane.comp.jakarta.log4j.user
Date: 2008-07-15 15:53:23 GMT
Subject: RE: JDBCAppender configuration
Newsgroups: gmane.comp.jakarta.log4j.user
Date: 2008-07-15 15:53:23 GMT
> The JDBCAppender is shoddy anyhow - write yourself a replacement. It's a > great way to learn about what makes a good Appender. To follow up: what I tend to do is have a custom JDBC Appender that adds a small custom log entry object (with all interesting info from the LoggingEvent) to a limited sized BlockingDeque and immediately returns. I have a background daemon thread that waits on the queue and adds the info to the logging database. I have a simple Connection test and failure recovery mechanism and I've hooked in a simple "purge" statement that can be run every few hours to limit the size of the log table, and some magic configuration entries so I can do some cool things inside activateOptions(). I'd post the classes if I wasn't developing proprietary software under NDA (and it wasn't so specific to my projects), but it's pretty simple stuff -- I learned most of how Log4J works by stepping through the source in Eclipse. Regards, Michael Erskine.
RSS Feed