others-How to solve 'not printing logs' or 'where is my tomcat logs' in tomcat?

How to solve not printing logs or where is my tomcat logs problem when using tomcat ? Or where is my tomcat logs?

Problem

After some time, you can not find the logs of tomcat , or you find that the apache tomcat is not printing logs anymore, why this happen?!

Solution #1

Check your operating system’s datetime settings, is the time sync with your laptop? Maybe it IS printing the logs with OLD date time. So check it.

Solution #2

Although all JDKs ship with logging functionality provided by java.util.logging, this default implementation is not designed for container-based environments. To get around this limitation, Tomcat replaces the default LogManager with JULI, a modified implementation with a number of additional features for handling containers.

Check your tomcat’s logging configurations, you can enable debug logging of tomcat (conf/logging.properties) with these settings:

org.apache.catalina.level=FINEST
java.util.logging.ConsoleHandler.level=FINEST

Here are other logging levels:

SEVERE - Serious failures

WARNING - Potential problems

INFO - Informational messages

CONFIG - Static configuration messages

FINE - Trace messages

FINER - Detailed trace messages

FINEST - Highly detailed trace messages

Solution #3

Are you checking the logs in the RIGHT folder ?

A neat trick is to run the command “lsof -p PID” where PID is the process id of your tomcat server. This command will give you a list of all files opened by the process, including the log file.

ps -ef| grep tomcat # get tomcat's PID
lsof -p PID # replace PID with the tomcat's real PID

By default, the logs should be at CATALINA_HOME/logs.