Skip to main content

Log4j:WARN Please initialize the log4j system properly.

Removing Log4j error
You will get the following error, if you haven't kept the log4j.properties etc. file in your classpath

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.

To avoid this error, please make sure that first you keep commons-logging.jar,log4j.jar in your classpath and most importantly keep log4j.properties in the classpath and keep the contenets of that as below.


# Default Logging Configuration
log4j.rootLogger= DEBUG, stdout
#to increase logging level
#log4j.logger.org.dcm4cheri=DEBUG
#to decrease logging level
#log4j.logger.org.dcm4cheri=ERROR
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%d{ ABSOLUTE} %-5p %x - %m\n

This should resolve the log4j error.

Comments

Popular posts from this blog

Design Patterns using Java

According to Gang of Four(GOF) any software is classified in to one of the three categories. I read so many books about design patterns which provide a lot of information about Design Patterns in a language neutral way or related to a particular programming language. I am trying to complement the great books by providing the precise and concise information that is required in the day to day programming of a Java Developer. Any software can be classified into one of the three categories -Framework, Toolkit, Application. Framework - Framework defines a set of steps to create an application. Framework provides design reuse. Toolkit - Toolkit provides some utility functions to an existing application. Toolkit provides code reuse. Application - Application is some thing that is specific to the project, and is not useful outside the context of the current application. Gang of Four divided the Design Patterns in to 3 types based on their usage. There are 3 types of Gang of Fo