You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Johannes Hoechstaedter <j....@memocomp.de> on 2008/07/15 16:20:59 UTC
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
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: JDBCAppender configuration
Posted by Johannes Hoechstaedter <j....@memocomp.de>.
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
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: JDBCAppender configuration
Posted by Thorbjørn Ravn Andersen <th...@gmail.com>.
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
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: JDBCAppender configuration
Posted by Johannes Hoechstaedter <j....@memocomp.de>.
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
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: JDBCAppender configuration
Posted by Michael Erskine <mi...@ketech.com>.
> 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.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: JDBCAppender configuration
Posted by Michael Erskine <mi...@ketech.com>.
Johannes Hoechstaedter [mailto:j.hoechstaedter@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.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org