wood burning stoves 2.0
The moose likes Struts and the fly likes struts & Log4J Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts & Log4J" Watch "struts & Log4J" New topic

struts & Log4J

Wendy Baur

Joined: Mar 01, 2005
Posts: 13
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

Joined: Feb 15, 2005
Posts: 4864

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.

Consultant, Sima Solutions
Wendy Baur

Joined: Mar 01, 2005
Posts: 13
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

Joined: Jan 27, 2004
Posts: 71
Try this:
rename your log4j.xml to log4j.properties

Wendy Baur

Joined: Mar 01, 2005
Posts: 13
I can't simply rename the file log4j.xml to log4j.properties because the files have completely different formats.
I agree. Here's the link: http://aspose.com/file-tools
subject: struts & Log4J
It's not a secret anymore!