• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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.
 
The moustache of a titan! The ad of a flea:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic