I have installed Tomcat, and using SLF4J as our logging framework. I copied slf4j-api-1.6.4.jar
and slf4j-jdk14-1.6.4.jar
into the Tomcat library i.e $TOMCAT_HOME/lib
.
I assumed that if I use SLF4J, it shall delegate to java.util.Logger
, which will delegate to underlying Tomcat logging framework. But when I deploy and check my application, I don't see anything getting logged. All my exception/log information is getting lost.
Is my understanding right, or did I miss anything to keep in class-path?
The main Apache Tomcat configuration file is at /opt/bitnami/tomcat/conf/server. xml. Once Apache Tomcat starts, it will create several log files in the /opt/bitnami/tomcat/logs directory.
This file is located in the logs directory below the Tomcat root directory. This log is the system's output log, which also consists of standard error messages. These files are saved daily (MM-DD-YYYY) with the date appended to the name of the data. Moreover, this log file persists during the functioning of the server.
By default, the catalina. out file is located in the logs directory under Tomcat's root directory. For example, /opt/netiq/idm/apps/tomcat/logs/catalina.
By default, the Tomcat HTTP Access Logs are stored in the dotserver/tomcat-X.x/logs/ folder within the dotCMS distribution, and the files are named dotcms_access. YYYY-MM-DD. log, where the YYYY-MM-DD in the file name is replaced by the date of the log file.
Instead of copying the slf4j-api-1.6.4.jar and slf4j-jdk14-1.6.4.jar under $TOMCAT/lib, i shipped these jars with the war application. in this case my exceptions are getting logged.
Probably what you need is to add the system property to the your CATALINA_OPTS.
For Windows systems, add to your %CATALINA_HOME\bin\catalina.bat file:
set CATALINA_OPTS=-Djava.util.logging.config.file=\PATH\TO\YOUR\logging.properties
or on Linux/UNIX systems, add to your $CATALINA_HOME/bin/catalina.sh file:
CATALINA_OPTS=-Djava.util.logging.config.file=/PATH/TO/YOUR/logging.properties
Don't forget that in Linux/UNIX systems, you need to quote if you have more than one parameters in the CATALINA_OPTS, e.g.
CATALINA_OPTS="-Xmx256m -Djava.util.logging.config.file=/PATH/TO/YOUR/logging.properties"
This line is to ensure that your logging.properties file is being loaded when Tomcat is started.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With