This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes How to... log4j ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to... log4j ?" Watch "How to... log4j ?" New topic
Author

How to... log4j ?

Daniel Platon
Ranch Hand

Joined: Oct 10, 2005
Posts: 42
Hello all,

I am trying to use log4j in my Struts application. So far I used the "defaults", i.e.

for initializing the logging system and then I used log.info(), log.debug() etc.
The problem is I am getting double posts in my logs. They have the same format, they have the same content. It just logs twice.
Why is this happening ? I searched the net and everything pointed to configuration issues when using custom loggers, but i'm not !
Below is my configuration of log4j.properties:



Any ideas ? Is this the way to use Log4J or do I have to write my own class ?

Thanks a lot !
Dan
[ May 03, 2007: Message edited by: Daniel Platon ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Since there is no difference in the way log4j is implemented in a Struts application than it is in any other application I'm moving this to the "Other Frameworks" forum.
[ May 04, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to... log4j ?
 
Similar Threads
How to... log4j ?
Hibernate transaction begin stuck
Log4J : log everything of a specific category to a file, but only errors to the file AND stdout ..
Two log files for two different classes in the same package
Log4j not printing file name