473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

log4j JDBC logging

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
2 7880
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Aaron Boxer | last post by:
Hello, My application is using a jar file MyJar.jar that uses log4j (I have the latest release of log4j). I have put both MyJar.jar and log4j.jar in a directory in my classpath. I have also...
4
by: Jan van Mansum | last post by:
Hello group, I have just been trying out the log4j library. As far as I understand the idea is to keep the logging statements in your, even in the release build. However, obviously you wouldn't...
2
by: BobReynolds | last post by:
We use Log4j for all our logging, I want to know why we have to do the following in EVERY class final private static org.apache.log4j.Logger log = LoggerUtil.getLogger(thisClassName.class); ...
1
by: XunLing | last post by:
hi, im using the xml appender for log4j and just found out how to use jdbc appender. Now i get all my system notifications into the database but i want to get only the nessasery user-"actions"....
0
by: sainiranji | last post by:
Hi All I have diffrent categories in diffrrent logging purpose and all are working fine...but now my requirment is to disable all at once . The below are change i did for disable all logges...
4
rsrinivasan
by: rsrinivasan | last post by:
Hi, I am using log4j to create log message. I want to write the log message to database. So i configured the log4j.properties files like this... # Database Configuration...
1
by: Kedar Kachare | last post by:
How to use Log4j to create log files using file appender in a Servlet? Also, how to make that Servlet read the log4j.properties file? I have tried following: My web.xml( I use Eclipse europa)...
0
by: Dinyjayas | last post by:
Dear guys, In my application, am using the concept as Log4j. In this i want to know that, how can i use the JDBC Appender which is in Log4j. In order to get the SQL query from EJBQL am...
5
myusernotyours
by: myusernotyours | last post by:
Hi all, I have scoured the net for this opinion, and I have come to the conclusion that many think log4j is the superior API. I therefore would like to hear the opinion of you guys here at bytes. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.