wood burning stoves
The moose likes Other Open Source Projects and the fly likes log4j says: log4j:WARN Please initialize the log4j system properly. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j says: log4j:WARN Please initialize the log4j system properly." Watch "log4j says: log4j:WARN Please initialize the log4j system properly." New topic

log4j says: log4j:WARN Please initialize the log4j system properly.

andres martin

Joined: Jun 20, 2012
Posts: 1
Hello I am trying to log information of my application.
I am using Loj4j and I see this tutorial: http://www.laliluna.de/articles/posts/log4j-tutorial.html

The problem is when I run the servlet without any log4j code says:

log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog).
log4j:WARN Please initialize the log4j system properly.
20/06/2012 08:14:45 PM org.apache.catalina.core.StandardService start

The code in a JAVA class(it is not a Servlet) to save in a log file is:

import org.apache.log4j.Logger;

private static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(ConexionPL.class);

Public void method()

The log4j.properties is in the root of the project(inside the SRC folder)
Here is the log4j.properties file:
# For the general syntax of property based configuration files see the
# documenation of org.apache.log4j.PropertyConfigurator.


log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %5p [%t] %c{1}:%L - %m%n

log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %5p [%t] %c{1}:%L - %m%n

The strage here is that the fode in the JAVA class is never executed, right? I don´t understand why is the exception.
Any help?

Please let me know if you have any questions, and sorry for my english.

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32625

Welcome to CodeRanch!

In that example, the property file is set up to ERROR (the most stringent level of logging), but the code only logs on a trace level. It shouldn't log.

As you note, it is even getting there. Not being able to configure logging looks like is being treated as a fatal error so you aren't getting to the method. Do you have the log4j property file in your path?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link: http://aspose.com/file-tools
subject: log4j says: log4j:WARN Please initialize the log4j system properly.
jQuery in Action, 3rd edition