JDBCAppender configuration

Hi everybody,

I am up to build a coocon webapplication, and I am using the 
JDBCAppender for logging. It works quite well. My only problem is, that 
when I switch on the loggin in debug mode, my application is as fast as 
a snail because of the heavy database traffic. How can I solve that? I 
need the debug mode, because on other modes like info or warn no 
interesting log events are logged. I want to log the database actions, 
so that it is possible to monitor all database changes by the 
application. I heard something about filter possibilities, but could not 
find any documentation. Do I need to write my own appender or logger? 
Which tutorial do you suggest?

cheers
Johannes
Michael Erskine | 15 Jul 17:38

RE: JDBCAppender configuration

Johannes Hoechstaedter [mailto:j.hoechstaedter <at> memocomp.de] wrote
> I am up to build a coocon webapplication, and I am using the
> JDBCAppender for logging. It works quite well. My only problem is, that
> when I switch on the loggin in debug mode, my application is as fast as
> a snail because of the heavy database traffic. How can I solve that? I
> need the debug mode, because on other modes like info or warn no
> interesting log events are logged. I want to log the database actions,
> so that it is possible to monitor all database changes by the
> application. I heard something about filter possibilities, but could not
> find any documentation. Do I need to write my own appender or logger?
> Which tutorial do you suggest?

Logging database actions to the database? I'd rethink what you're trying to achieve with the logs! Add a
simple FileAppender or even ConsoleAppender to debug what your app is doing and set a threshold of INFO on
your JDBCAppender.

The JDBCAppender is shoddy anyhow - write yourself a replacement. It's a great way to learn about what makes
a good Appender.

Regards,
Michael Erskine.
Michael Erskine | 15 Jul 17:53

RE: JDBCAppender configuration


> 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.

Re: JDBCAppender configuration

Michael Erskine schrieb:
>> 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.
>   
Thank you Michael, thats the way I went, too, and it works.

cheers
Johannes

Re: JDBCAppender configuration

Johannes Hoechstaedter skrev  den 15-07-2008 16:20:
> Hi everybody,
>
> I am up to build a coocon webapplication, and I am using the 
> JDBCAppender for logging. It works quite well. My only problem is, 
> that when I switch on the loggin in debug mode, my application is as 
> fast as a snail because of the heavy database traffic. How can I solve 
> that? I need the debug mode, because on other modes like info or 
Without having used it, I would suspect that you have autocommit on (the 
default) on your JDBC-connection.

--

-- 
  Thorbjørn

Re: JDBCAppender configuration

Thorbjørn Ravn Andersen schrieb:
> Johannes Hoechstaedter skrev  den 15-07-2008 16:20:
>> Hi everybody,
>>
>> I am up to build a coocon webapplication, and I am using the 
>> JDBCAppender for logging. It works quite well. My only problem is, 
>> that when I switch on the loggin in debug mode, my application is as 
>> fast as a snail because of the heavy database traffic. How can I 
>> solve that? I need the debug mode, because on other modes like info or 
> Without having used it, I would suspect that you have autocommit on 
> (the default) on your JDBC-connection.
>
Yeah you are right, when you look into the sources, the JDBC-Appender 
commits by default.

cheers

Gmane