• 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

struts & Log4J

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

I'm using struts, log4j and the JBoss web server...here's my problem:

I'm trying to setup log4j with struts and I've done the following things:
1) Put the log4j.xml file in WEB-INF/classes directory.
2) Added the log4j.jar file to the classpath (in my build file)

I'm still getting the following error in my log:
log4j:WARN no appenders could be found for logger mylog
log4j:WARN Please initialize the log4j system property

I had one of my co-workers use the appender in a non-struts related .java file and it works fine. PLEASE HELP What am I doing wrong???
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wendy,

What this message is telling you is that your log4j.xml file has an error. It's expecting a logger named mylog to have an appender assigned to it, and isn't finding the entry that it's expecting.
 
Wendy Baur
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually if I use the same logger in a non-struts file everything works find. It's when I use the logger in a struts file that I get an error.
[ May 04, 2005: Message edited by: Wendy Baur ]
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this:
rename your log4j.xml to log4j.properties

--Nimchi
 
Wendy Baur
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't simply rename the file log4j.xml to log4j.properties because the files have completely different formats.
reply
    Bookmark Topic Watch Topic
  • New Topic