Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts & Log4J

 
Wendy Baur
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • 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???
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
Nimchi Yung
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I can't simply rename the file log4j.xml to log4j.properties because the files have completely different formats.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic