Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How to configure log4j2 in tomcat 7  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to configure log4j2 in tomcat7 as per instruction in http://stackoverflow.com/questions/28446085/tomcat-7-internal-logging-with-log4j2-xml
but it is not working for me.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

download log4j for
https://logging.apache.org/log4j/1.2/download.html

unzip the log4j.jar e paste in WEB-INF/LIB

then use the following link

http://www.mkyong.com/tutorials/log4j-tutorial/

regard
 
Bartender
Posts: 20775
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm afraid that Luca's instructions are for adding Log4j to a single webapp, but you're apparently attempting to add log4j to the Tomcat server itself. Tomcat's documentation doesn't do a very good job of explaining that each webapp is responsible for its own logging and the server itself also has logging which is independent of the webapps. Or at least, it was never clear to me.

Regardless "It doesn't work" doesn't tell us anything useful. We need details. Any error messages that may come from the catalina.out file or any of the other files in the Tomcat log directory would be a good start. Note that if your logging didn't "take", the Tomcat server often places server-specific error messages in the "localhost" log files.

Do make sure that you use absolute file locations for your logfiles. Although in theory relative file locations would be based on the TOMCAT_HOME directory, sometimes it's better to leave no doubt.

 
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!