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

HashMap in Java

1) Implement HashMap in Java, with the put and get operations   HashMap can be implemented in Java Using Arrays. Use the same logic that the Out of the Box   HashMap follows, for resizing, and load factor, when ever the HashMap reaches the size of the   resize with the load factor a new Array is created, and the previous array contents are copied over   to the new Array.  HashMap is Not Synchronized by default. We can synchronize the whole map by using Synchronization, or by using collection.synchronizedmap(map), which synchronizes all the operations on the map. Alternatively We can use the CocurrentHashMap which does not lock the read operations, rather locks the segments that are being written. 2) HashMap vs LinkedHashMap vs IdentityHashMap 3) HashMap vs ConcurrentHashMap 4) Implement a Cache using LinkedHashMap