• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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".
 
Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!