Java Web Servers » Tomcat » How to set Looger in tomcat
Putting log4j.jar in lib directory working fine, we need to take care about log4j.properties, it should be in class path.
222 Views
5 Replies
How to set Looger in tomcat
Posted 26-02-2009Reply
I want to implement logger functionality in Tomcat any one can help me in this
Apache Tomcat comes with default logger which logs the activity of the server.
How ever if you need to log from the Application you will need to have a logger entry in your project POM(The file where you declare the dependency for the jars) depending on which logging system you are using
Kaustubh
How ever if you need to log from the Application you will need to have a logger entry in your project POM(The file where you declare the dependency for the jars) depending on which logging system you are using
Kaustubh
First of all, what do u want to do. R u asking about application log or server log. C.. if it is server log, that will be their in Tomcat directory under server logs folder.
But I think u want to configure logger for your application. Logging system of any king of application is not dependent on any king of server. It will not be specific to tomcat.
Use any framework for logging like Log4J. I think its best one.
I want to answer, question raised by one of the Forum member here. We require saparate log for application.Server log is not enough because it will contain all teh processing steps which r not required for our perpose. Our perpose is to debug our business fuctionality at develoment and production time.We can give log statement inside ur application for example any exception comes or any flow etc. At debugging u can check log.
Ur application log will contain logs which is specific to ur application not all junk data which comes on server log.
But I think u want to configure logger for your application. Logging system of any king of application is not dependent on any king of server. It will not be specific to tomcat.
Use any framework for logging like Log4J. I think its best one.
I want to answer, question raised by one of the Forum member here. We require saparate log for application.Server log is not enough because it will contain all teh processing steps which r not required for our perpose. Our perpose is to debug our business fuctionality at develoment and production time.We can give log statement inside ur application for example any exception comes or any flow etc. At debugging u can check log.
Ur application log will contain logs which is specific to ur application not all junk data which comes on server log.
I guess Log4j is the most common logging API and easy to configure. You may go with it. All you need it log4j.properties file and log4j.jar in your classpath. I guess WebAppClassLoader (putting jar and property file in WEB-INF/lib doesn't work) is not able to load log4j.jar, you need to put it in classpath (not sure but if i remember correctly, I had this problem too).
I guess Log4j is the most common logging API and e... See Ravindra's complete reply
Putting log4j.jar in lib directory working fine, we need to take care about log4j.properties, it should be in class path.













