A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Other Open Source Projects
help write log4j output to a file
Joined: Jul 30, 2004
Sep 13, 2004 08:51:00
I'm trying to get log4j up and running quickly for the first time. I just want to write everything to a file. What would the log4j.properties file look like for that? I've tried:
But I get log4j warnings :
log4j:WARN No appenders could be found for logger (Log4J).
log4j:WARN Please initialize the log4j system properly.
Joined: Aug 03, 2002
Sep 23, 2004 04:22:00
You have probably fixed this yourself by now, but this is what I did to get your example to work:
log4j.rootLogger=ALL,default log4j.appender.default=org.apache.log4j.RollingFileAppender log4j.appender.default.File=example.log log4j.appender.default.layout=org.apache.log4j.SimpleLayout
Notice the level ALL on the rootLogger (rootCategory is obsolete) and the addition of the layout line.
Ask a Meaningful Question
Getting someone to think and try something out is much more useful than just telling them the answer.
It is sorta covered in the
JavaRanch Style Guide
subject: help write log4j output to a file
log4j.properties not found
Test methods that throw an exception
Log4j in a web application
Using Netbean 6.8 to create a Servlet app that queries a database
Tomcat 5.5 SEVERE: Error listenerStart
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015