By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,798 Members | 1,349 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,798 IT Pros & Developers. It's quick & easy.

log4j JDBC logging

P: n/a
I have a various different packages within this web application that I
am writing and I am attempting to set up log4j to log directly to a
database. So each class is calling just a generic logger:
Logger.getLogger("generic");

and I have the PropertyConfigurator read in some properties from a log
file that define the database connection, the user, pass, ...

The logging to the database works, but it does not log every statement
it comes across. I have defined numerous logger.debug() statements
throughout the code and the first 6 statements throughout various
classes will be logged, but other logging statements will not.

So I set up just a stupid Logger that logs to a file on the system and
placed log statements after each log4j statement that I have in each
class. The stupid logger will successfully log all of the statements,
but the log4j statements stop logging after a bit.

Why would this be? Are statements getting lost because I am
connecting to the database? The database is on the local machine so I
couldn't imagine that being the case...does anyone have any ideas?
Thanks for your thoughts...
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Are you using JDBCAppender that comes with Log4J? If yes, try calling
the flushBuffer() method on the appender to flush the cached events.
Beside, before your program exits call the LogManager.shutdown() method.

Pete.

Greg Scharlemann wrote:
I have a various different packages within this web application that I
am writing and I am attempting to set up log4j to log directly to a
database. So each class is calling just a generic logger:
Logger.getLogger("generic");

and I have the PropertyConfigurator read in some properties from a log
file that define the database connection, the user, pass, ...

The logging to the database works, but it does not log every statement
it comes across. I have defined numerous logger.debug() statements
throughout the code and the first 6 statements throughout various
classes will be logged, but other logging statements will not.

So I set up just a stupid Logger that logs to a file on the system and
placed log statements after each log4j statement that I have in each
class. The stupid logger will successfully log all of the statements,
but the log4j statements stop logging after a bit.

Why would this be? Are statements getting lost because I am
connecting to the database? The database is on the local machine so I
couldn't imagine that being the case...does anyone have any ideas?
Thanks for your thoughts...


--

You don't pay to get spam, why pay to clean it?
Visit http://www.spammarshall.com to create an account for free
<http://www.spammarshall.com>

Jul 17 '05 #2

P: n/a
Greg Scharlemann wrote:
I have a various different packages within this web application that I
am writing and I am attempting to set up log4j to log directly to a
database. So each class is calling just a generic logger:
Logger.getLogger("generic");

and I have the PropertyConfigurator read in some properties from a log
file that define the database connection, the user, pass, ...

The logging to the database works, but it does not log every statement
it comes across. I have defined numerous logger.debug() statements
throughout the code and the first 6 statements throughout various
classes will be logged, but other logging statements will not.

So I set up just a stupid Logger that logs to a file on the system and
placed log statements after each log4j statement that I have in each
class. The stupid logger will successfully log all of the statements,
but the log4j statements stop logging after a bit.

Why would this be? Are statements getting lost because I am
connecting to the database? The database is on the local machine so I
couldn't imagine that being the case...does anyone have any ideas?
Thanks for your thoughts...


Greg,

I would start by changing the log4j configuration to log to a file
instead of the database. Then you will know if the problem is specific
to the database or not.

Ray

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.