I made a simple Hibernate 3.1
java code (in eclipse) which successfully creates a table in a database. I have slfj-api-1.6.0.jar
and slfj-simple-1.6.0.jar
in my project. But, I don't see any Log4j
logging warnings or messages in the console output. How do I make log4j log things to my console ?
My tutorial says that one of the lines I should get in the console is -
log4j.logger.org.hibernate.type = debug
I saw a couple of posts online which tell me to place a Log4j.properties
file in my java project, either in src
folder, or make a resources
folder inside src
and put it there. I found one Log4j.properties
in my computer and placed it in the resources
folder. I am not sure if I should use the settings in that file or how to edit this file as per my requirement. How do I do this correctly ?
EDIT -
The log4j.properties
file -
### Direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### set log levels - ###
log4j.rootLogger=warn, stdout log4j.logger.org.hibernate.info
### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=debug
###log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=debug
Thanks.