Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming 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
  • 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

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!
 
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!