4.7.1. Logging Configuration for Web Applications

CoreMedia web applications use a common logging component which is based on Logback. The log configuration for each web application is located in WEB-INF/logback.xml. If no configuration file is provided, a fallback configuration is used.

The default log directory is set to ./logs. It can be changed by providing the property coremedia.logging.directory either in WEB-INF/application.properties, as a system property, or as a JNDI property java:comp/env/coremedia/logging/directory.

It is also possible to access the log configuration via JMX using com.coremedia:Type=Logging,application=<applicationname>.

The logging configuration contains reasonable defaults which you can override if required. You can define the properties log.pattern and log.file in your project logback.xml file. For example to enable tenant logging for Elastic Social in your log pattern it can be defined like this:

 <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} %-7([%level]) %logger - [%X{tenant}] %message \\(%thread\\)%n" />

For more information about the logging component, see the Section 4.3.7.1, “The Logging Component” in CoreMedia Digital Experience Platform 8 Developer Manual for details.