Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help with log4j logging tool to log into database

 
Ravi Singh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need help with log4j logging tool (org.apache.log4j.*) to log into database using JDBCAppender. Have look at my logger code and corresponding log4j.properties file stated below. I'm running this program using Eclipse IDE and it's giving me the following error (in bold) at the end:

log4j: Parsing for [root] with value=[debug, stdout, Roll, CRSDBAPPENDER].
log4j: Level token is [debug].
log4j: Category root set to DEBUG
log4j: Parsing appender named "stdout".
log4j: Parsing layout options for "stdout".
log4j: Setting property [conversionPattern] to [%x %d{HH:mm:ss,SSS} %5p [%t] (%c:%-4L %M) - %m%n].
log4j: End of parsing for "stdout".
log4j: Parsed "stdout" options.
log4j: Parsing appender named "Roll".
log4j: Parsing layout options for "Roll".
log4j: Setting property [conversionPattern] to [%x %d{yyyy.MM.dd HH:mm:ss,SSS} %5p [%t] (%c:%-4L %M) - %m%n].
log4j: End of parsing for "Roll".
log4j: Setting property [file] to [HelloWorld.log].
log4j: Setting property [maxBackupIndex] to [10].
log4j: Setting property [maxFileSize] to [20KB].
log4j: setFile called: HelloWorld.log, true
log4j: setFile ended
log4j: Parsed "Roll" options.
log4j: Parsing appender named "CRSDBAPPENDER".

Can't find class HelloWorld







Here is the directory structure of my program. My log4j.properties file and HelloWorld.class file are residing in folder HelloWorld\bin.

HelloWorld\bin
HelloWorld\lib
HelloWorld\src

Please note - The same program works fine for console and file appender when I comment the database appender part in my properties file.
Thanks
Ravinder
[ September 17, 2007: Message edited by: Ulf Dittmer ]
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello "RSG RSG"-

Welcome to JavaRanch.

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.

As to your question, it sounds like the classpath is not set correctly. Does it include the HelloWorld\bin directory? Does the program run at all?
 
Ravi Singh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes the program works fine if I remove (or comment) the database appender settings in properties file.
 
Ravi Singh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got my program working now. I was using the wrong version of log4j library in my build path. Thanks for your pointer, Ulf...

Cheers!
Ravi Singh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic