Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting log4j:ERROR No appenders could be found for category

Status
Not open for further replies.

brainchild1977

Programmer
Feb 1, 2005
9
US
Hello,

Am using log4j to log errors for my Java application. When i run the unix script I can the following error message:

log4j:ERROR No appenders could be found for category (classname).
log4j:ERROR Please initialize the log4j system properly.

I do have the log4j.jar included in my classpath..

What could be the problem?
 
Where do you have log4j.jar installed ? Which version ?

--------------------------------------------------
Free Database Connection Pooling Software
 
You must either configure the logging in your code, or better - use a log4j.properties file on the classpath. At a basic level, this could contain, for example:-
Code:
# Set root logger level and its appender.
# Valid levels are INFO, DEBUG, WARN, ERROR and FATAL
log4j.rootLogger=ERROR

# Set logger level for all classes in my package structure
log4j.logger.[b][i]<your top-level package>[/i][/b]=INFO, Console

# Console is set to be a ConsoleAppender.
log4j.appender.Console=org.apache.log4j.ConsoleAppender

log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Hope this does the trick.

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top