• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Path to locate properties file of log4j  RSS feed

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using log4j in my WebApplication.
Where I must configurate path or classpath in Tomcat to locate logXX.properties (properties file of log4j).
Thanks
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you don't need to configure log4j or tomcat in any special way.

Log4j will attempt to find a log4j.properties file on the classpath. So if you place your log4j.properties file in WEB-INF/classes it's pretty much guaranteed to be found. (That's what I do for my apps, and it works).
 
Haroldo Nascimento
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does not works in mey tomcat. How I can configurate my classpath in tomcat? I need alter any .bat (what) or only web.xml or struts-config.xml is necessary ?
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Classpath is something you should *not* concern yourself with for Tomcat. Tomcat takes care of its own classpath settings. Read up on Tomcat's classloaders here:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html

What do you have in the following directories:

CATALINA_HOME/common/lib
your_webapp/WEB-INF/lib
your_webapp/WEB-INF/classes

Also, check tomcat's logs for error messages. If there's a mistake in log4j.properties, it might appear that log4j is not configured at all. In this case, log4j reverts to using System.out.

on windows: CATALINA_HOME\logs\stderr.log or CATALINA_HOME\logs\stdout.log
on unix: CATALINA_HOME/logs/catalina.out

Also, how are you using log4j in your application? Are you using a configurator or just the 'easy' way like:



Finally, please tell us what you mean by "it does not work".
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!