This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

log4j and tomcat 6.x problem - not writing to the log files

 
Ranch Hand
Posts: 50
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am planning to have two separate log files for different packages - one for app and other for daos.

I am using following log4j.xml



I am using following log4j.properties file




And in my class in ex.com.app package I am using
private static Logger log = Logger.getLogger(LogonAction.class);

And in my class in ex.com.dao package I am using
private static Logger log = Logger.getLogger(LogonDAOImpl.class);

I am deploying the application on tomcat 6.x and I made sure that I have log4j.dtd, log4j.xml & log4j.prop file in the classpath WEB-Inf/classes/

It is creating the log files in the location I specified but it is never writing into these files.

Am I missing something or are there any configuration that are specific to tomcat? please help!!

thanks in advance...
 
Srikanth Madasu
Ranch Hand
Posts: 50
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried a sample java proj in eclipse sing same code, and it worked fine.

So I am guessing it has to do something with the tomcat configuration.

Did anyone successfully used log4j on tomcat server? please help!!!

 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to have both log4j.properties and log4j.xml, you should just stick with one (log4.xml being preferred).
 
Srikanth Madasu
Ranch Hand
Posts: 50
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.. but that did not really make any difference

 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you might be missing something from your xml configuration, here's a sanmple of what I use:


 
Srikanth Madasu
Ranch Hand
Posts: 50
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Its now working. I used the following code. I am posting it so that it may be useful to other.




Thanks a bunch for your help!!!
 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad you got it working!
 
Water! People swim in water! Even tiny ads swim in water:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!