• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

help write log4j output to a file

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

log4j.rootCategory=default
log4j.appender.default=org.apache.log4j.RollingFileAppender
log4j.appender.File=example.log

But I get log4j warnings :

log4j:WARN No appenders could be found for logger (Log4J).
log4j:WARN Please initialize the log4j system properly.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have probably fixed this yourself by now, but this is what I did to get your example to work:


Notice the level ALL on the rootLogger (rootCategory is obsolete) and the addition of the layout line.
reply
    Bookmark Topic Watch Topic
  • New Topic