• 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
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Issues with log4j in Tomcat

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been trying to get my (smartgwt)application to log using the log4j jar. It works fine in Dev Mode, but when I deploy it to tomcat the log files denoted by the configuration don't even seem to appear.

The following log4j.properties file is in my war directory for my app:


Just to get it working I have a simple class with static log methods only accessing the rootLogger:


On server side calls I simply have statements such as:


Are there settings within the Tomcat environment to allow application specific use of log4j, or am I simply going about this wrong? I have read in a few places about people saying to put my .properties file into WEB-INF/classes directory, but when my war file is unpacked by Tomcat I don't see that directory.
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to ensure that the .properties file is on the CLASSPATH, WEB-INF/classes is definitely a safe place for that purpose. Are you using exploded WARs? If so you can try dropping in the .properties file after the WAR deployment.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!