Problem in executing program of log4j

I have written a simple code for accessing the functionality of log4j.jar. It is as follows :

import org.apache.log4j.Logger;

import org.apache.log4j.*;

public class Log4jDemo {

static Logger log = Logger.getLogger("Log4jDemo");

public static void main(String args[]) {

log.debug("This is my debug message.");

log.info("This is my info message.");

log.warn("This is my warn message.");

log.error("This is my error message.");

log.fatal("This is my fatal message.");

}

}

I am able to compile it but getting problem while execution. The errors are listed below :

C:\Program Files\Java\jdk1.5.0\bin>java Log4jDemo

log4j:ERROR JDBCAppender::setSqlhandler(), sqlhandler must be derived of JDBCSql

Handler !

log4j:ERROR JDBCAppender::setSqlhandler(), sqlhandler must be derived of JDBCSql

Handler !

log4j:WARN No appenders could be found for logger (Log4jDemo).

log4j:WARN Please initialize the log4j system properly.

Please help me out...

[1070 byte] By [prog_qrya] at [2007-11-26 22:54:25]
# 1
is your log4j.properties is well configured?
suparenoa at 2007-7-10 12:18:17 > top of Java-index,Java Essentials,Java Programming...
# 2
I have written the above code as java file. Then I also specified the jar file path. Do I need to configure anything more?
prog_qrya at 2007-7-10 12:18:17 > top of Java-index,Java Essentials,Java Programming...
# 3
> I have written the above code as java file. Then I> also specified the jar file path. Do I need to> configure anything more?yes, you need a log4j configuration file. it's all explained in the log4j docs
georgemca at 2007-7-10 12:18:17 > top of Java-index,Java Essentials,Java Programming...
# 4

Thanks a lot... I have tried and its working... I wrote :-

log4j.rootLogger=DEBUG, CONSOLE

log4j.appender.FILE=org.apache.log4j.FileAppender

log4j.appender.FILE.file=/tmp/logs/log.txt

log4j.appender.FILE.layout=org.apache.log4j.PatternLayout

log4j.appender.FILE.layout.ConversionPattern=[%d{MMM dd HH:mm:ss}] %-5p (%F:%L) - %m%n

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender

log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout

log4j.appender.CONSOLE.layout.ConversionPattern=[%d{MMM dd HH:mm:ss}] %-5p (%F:%L) - %m%n

prog_qrya at 2007-7-10 12:18:17 > top of Java-index,Java Essentials,Java Programming...
# 5

for JDBCAppender

http://www.dankomannhaupt.de/projects/index.html

don't forget that the JDBCAppender will not be supportd in the fututre log4j version!!

and for properties and 'normal' logging

http://www.vipan.com/htdocs/log4jhelp.html

and go to the log4j apache website for more info on log4j

suparenoa at 2007-7-10 12:18:17 > top of Java-index,Java Essentials,Java Programming...