Several different types of log files are stored by dotCMS and the application server where you run the dotCMS application (please see the Logging Configuration documentation for more information). By default, each of the different types of log files is stored in different default locations. However you may change the locations of all log files; please see the following documentation sections for more information.
Default Log File Locations
Log Files
The following list shows the different types of log files and the default locations for each type of file.
Log File Type | Default Location |
---|---|
dotCMS Application Log Files | dotserver/tomcat-X.x.x/webapps/ROOT/dotsecure/logs/ |
ElasticSearch Slow Query Log Files | dotserver/tomcat-X.x.x/logs/ |
Tomcat Main Log File | dotserver/Tomcat-X.x.x/logs/catalina.out |
Tomcat HTTP Access Logs | dotserver/tomcat-X.x.x/logs/dotcms_access.YYYY-MM-DD.log |
Tomcat Historical Logs | dotserver/Tomcat-X.x.x/logs/catalina.%Y-%M-%D.log |
Note: For information on log files generated by application servers other than Tomcat, please see Other Application Servers, below.
Console Logging
In addition, both application server and dotCMS application log messages may be logged to the console. The following shows the default console logging configuration:
Log Messages | Default Configuration |
---|---|
dotCMS Application Messages | Disabled |
Tomcat Messages | Enabled |
Changing the Location Where Log Files Are Stored
You may use the following methods to change the locations where all log files generated by dotCMS are stored.
dotCMS Application Log Files
There are two ways to change the locations where log files are stored.
1. Change the DYNAMIC_CONTENT_PATH
Property
The DOTCMS_LOGGING_HOME
property is automatically created based on the DYNAMIC_CONTENT_PATH
property; so when you change the DYNAMIC_CONTENT_PATH
property, it automatically also changes the location where the log files are stored. For example, if you change the DYNAMIC_CONTENT_PATH
property to /opt/dotcms/dotsecure, then the dotCMS log files will be stored in /opt/dotcms/dotsecure/logs.
Note: It is strongly recommended that you do not change dotCMS properties directly within the properties files. For more information about how to change dotCMS properties, please see the Changing dotCMS Configuration Properties documentation section).
2. Change log4j2.xml File Properties
The log file names and folder locations are specified in the *_LOG_FILE
and *_FILENAME_PATTERN
properties in the Properties section of the log4j2.xml file. To change the folder log files are written to, replace the default location ${sys:DOTCMS_LOGGING_HOME}
in each of these properties with the full path to the new desired log file location.
ElasticSearch Slow Query Logs
You may configure ElasticSearch in dotCMS to automatically log slow ElasticSearch queries, to help you identify and improve queries that take longer than expected. By default, the location of the files that log slow ElasticSearch queries is $DOTCMSHOME/dotserver/tomcat-X.x.x/logs. You may change this by setting the es.path.logs
property in the dotmarketing-config.properties file.
Note: It is strongly recommended that you do not change dotCMS properties directly within the properties files. For more information about how to change dotCMS properties, please see the Changing dotCMS Configuration Properties documentation section).
Application Server Log Files
In addition to the dotCMS log files, the application server that runs dotCMS also generates its own log files. On production systems you may wish to modify the logging configuration of the application server to change logging behavior or improve performance.
Tomcat Logging
The dotCMS distribution ships with the Tomcat application server (the exact version of Tomcat may vary depending on the dotCMS release). The Tomcat application server performs three different kinds of logging; you may use the following methods to change Tomcat logging.
Note: It is strongly recommended that all changes to Tomcat and dotCMS configuration files be made through a ROOT folder plugin.
Tomcat Main Log Files (catalina.out)
The location and name of the Tomcat main log file are specified via the CATALINA_OUT
environment variable. To change the Tomcat log file, it is recommended that you set this environment variable within the dotCMS startup.sh
file (or startup.bat
on Windows). For example:
if [ -z "$CATALINA_OUT" ] ; then
CATALINA_OUT="$DOTCMS_HOME/dotserver/Tomcat-X.x.x/logs/catalina.out"
fi
Note that several additional log files are created in the same folder as the main log file, but other than the HTTP access log (see below), these files are rarely of interest for monitoring or troubleshooting dotCMS performance.
Tomcat HTTP Access Logs (dotcms_access.*)
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.
You can change both the location and names of the Tomcat access logs by editing the AccessLogValve property in the Tomcat server.xml file (dotserver/tomcat-8.0.18/conf/server.xml).
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="dotcms_access" suffix=".log"
pattern="%h %l %u %t %r %H %v%U%q %s %b %{Referer}i %{User-Agent}i" resolveHosts="false "/>
Note: The root of the directory specified for the AccessLogValve defaults to the Tomcat root folder ($DOTCMS_HOME/dotserver/Tomcat-X.x.x), not the dotCMS installation root folder.
Tomcat Historical Logs
Tomcat automatically rolls all its log files (including both the main Tomcat log file and the HTTP access logs, starting a new version of each log file every day, and saving the previous day's log file to a new file that begins with the same file name as the original log file, but ends with the date of the log (%Y-%M-%D.log). For example, the Tomcat main file (catalina.out) for January 1st, 2016 will be saved and renamed to catalina.2016-01-01.log.
The Tomcat historical log files are kept in the same location as the Tomcat main log file, and when the location of the main log file is changed, the location of these files will also be changed.
Tomcat Console Logging
By default, the Tomcat server is configured to log all Tomcat messages to both the Tomcat main log file and the standard output (stdout). On large sites and production servers we recommend that you disable Tomcat console logging to improve performance.
To disable Tomcat console logging, edit the logging.properties file in the Tomcat distribution (dotserver/tomcat-8.0.18/conf/logging.properties) and remove java.util.logging.ConsoleHandler
from the .handlers
line. For example:
#.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.AsyncFileHandler
For more information on configuring logging in Tomcat 8, please see the Apache Logging in Tomcat documentation.
Tailing Log Files in Non-Default Locations
By default, only the dotCMS Application log files will be viewable using the Log Files tab in the System → Maintenance screen. And even these log files will only be viewable when the log files are stored in the default location.
However you can configure dotCMS to display your dotCMS application log files in any location, and possibly to display additional log files (such as your application server log files). For information on how to change the location where dotCMS looks for your log files, please see the dotCMS Log & Audit Logging documentation.