The following configurations allow you to enable special logging features for use in troubleshooting dotCMS.
Note: All of these features greatly increase the amount of logging performed by dotCMS, and may significantly impact performance. It is strongly recommended that you do not enable these features on production systems.
Velocity Template Logging
When developing Templates, it may be useful to log the template name to verify which templates are being used, and identify which template may be causing an error. By default this feature is disabled, and template names are not logged.
To turn on template logging:
- Set the
LOG_VELOCITY_TEMPLATES
property to true in the dotmarketing-config.properties file:LOG_VELOCITY_TEMPLATES=true
- Set the
VELOCITY_PROFILING
property to true in the dotmarketing-config.properties file:## LOGGING/PROFILING CONTROLS VELOCITY_PROFILING=true
After you make these changes, the name of each Velocity template will be logged before it is parsed.
Important Notes:
- It is strongly recommended that you make all changes to the dotmarketing-config.properties file through a properties extension file.
- Velocity profile logging will be written to the dotcms.log file.
SQL Query Logging
When troubleshooting SQL queries, it may be helpful to log the actual queries sent to the database so they can be manually inspected and verified. By default, this feature is disabled, and SQL queries are not logged.
To enable this feature, set the hibernate.show_sql
property in the system.properties file to true:
hibernate.show_sql=true
Important: This feature should not be enabled on production systems.
- Enabling this feature greatly increases log sizes and causes significant performance degredation.
- This feature is intended for troubleshooting and debugging purposes only.
- The
hibernate.show_sql
property should be reset to false as soon as troubleshooting is completed.
- The
Note: It is strongly recommended that you make all changes to the system.properties file through a properties extension file.
ElasticSearch Slow Query Logging
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, this feature is disabled, and no log files are created to log slow queries.
To enable this feature, uncomment all the properties in the dotcms-cluster-config.properties file that begin with es.index.search.slowlog
.
Note: It is strongly recommended that you make all changes to the dotcms-cluster-config.properties file through a properties extension file.
es.index.search.slowlog.level=WARN
es.index.search.slowlog.threshold.query.warn=10s
es.index.search.slowlog.threshold.query.info=5s
es.index.search.slowlog.threshold.query.debug=2s
es.index.search.slowlog.threshold.query.trace=500ms
es.index.search.slowlog.threshold.fetch.warn=1s
es.index.search.slowlog.threshold.fetch.info=800ms
es.index.search.slowlog.threshold.fetch.debug=500ms
es.index.search.slowlog.threshold.fetch.trace=200ms
Where:
Property | Description |
---|---|
es.index.search.slowlog.level | Specifies the logging level to use for slow ElasticSearch queries. This level will be used to determine which of the threshold.query and threshold.fetch properties are used. |
es.index.search.slowlog.threshold.query | Sets the time limit to send a query and receive a response. |
es.index.search.slowlog.threshold.fetch | Sets the time limit to fetch all the query results. |
Rules Feature Slow Rule Logging
Since Rules may be executed as often as every time a user visits any page, Rules that execute slowly may significantly impact the performance of your site. You may troubleshoot Rules performance issues by setting the SLOW_RULE_LOG_MIN
property in the dotmarketing-config.properties file:
SLOW_RULE_LOG_MIN=100
Note: It is strongly recommended that you make all changes to the dotmarketing-config.properties file through a properties extension file.
The value you set specifies a time limit in milliseconds; any time a rule takes longer to execute than you specify, a message will be logged to the dotCMS log file.
Java Garbage Collection Logging
In some rare cases, you may wish to log information about Java garbage collection in order to troubleshoot Java performance or memory usage. To enable this feature, the following flags must be added to the JAVA_OPTS
environment variable in the dotCMS startup script:
-verbose:gc
-Xloggc:$DOTCMS_HOME/dotserver/tomcat-X.xx/logs/gc.log
-XX:+PrintGCDateStamps
-XX:+PrintGCDetails
-XX:+PrintTenuringDistribution
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintHeapAtGC
-XX:+PrintPromotionFailure
Abandoned DB Connections Logging
dotCMS is configured to automatically log any database connections which detected as leaked (when a database connection is opened, but not closed properly). This situation is rare, but when it does occur this logging enables dotCMS support and development teams to troubleshoot and resolve some issues which may be very difficult to resolve without this logging.
To enable abandoned connection logging, you must set your leakDetectionThreshold
to the number of milliseconds after which a connection will be logged as a leaked connection. This is done in your db.properties
file.
The following example shows a database resource properly configured to log abandoned connections after 60 seconds.
##Postgres default configuration driverClassName=org.postgresql.Driver jdbcUrl=jdbc:postgresql://localhost/dotcms username=dotcms password=dotcms connectionTestQuery=SELECT 1 maximumPoolSize=60 ##Max idle in seconds idleTimeout=10 ##Max wait in milliseconds maxLifetime=120000 ##LeakDetectionThreshold in milliseconds leakDetectionThreshold=60000