• Post Reply Bookmark Topic Watch Topic
  • New Topic

log4j properties in class.loader  RSS feed

 
Ranch Hand
Posts: 105
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

Thank you for any help.

I have a log4j.properties file in the usual location:



To externally override this I added a copy (changing the log file name only) of log4j.properties in the classpath of tomcat i.e.

// catalina.properties


// copy log4j.properties


This all works fine and I can see my new "newfile.log" being written to. The problem is that after around 3-5 seconds, the OLD file starts getting written to instead (i.e. the one specified in old location):



So works fine - then switches to using the old (original) log4j.properties file under WEB-INF/classes/properties/

Any idea whats happening?

Regards, Sam




 
sam wootton
Ranch Hand
Posts: 105
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apologies - I have found the issue. Another app (jar) is re-initialising log4. I added log4 debug to JAVA_OPTS catalina.sh and saw:



then later reported



Regards, Sam
 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I see... so because you installed log4j in such a way that there's one copy used by all applications, when an application behaves badly then other applications suffer. The usual practice is to install a separate copy of log4g with each application which needs it, and then there can't ever be a conflict.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!