Logging
Cadenza includes a default logging configuration in its distribution and Docker container that contains sensible defaults. Here we show the default logging configuration for reference and inspiration. If you want to supply your own logging configuration see Environment Variables, System Properties and Other Runtime Configuration Options for the relevant properties.
We also have several variables defined in our configuration that you can easily override using environment variables to make certain subsystems of Cadenza log more information for debugging purposes. See Subsystem Loglevels.
If you set the log level below WARN you may trigger a significant amount of log output. Starting with the DEBUG level and lower, so much information is logged that it will seriously impact performance of Cadenza.
DEBUG and below should never be used in production for a sustained period.
|
Default Configuration
<?xml version="1.0" encoding="UTF-8"?>
<!-- 'strict' must be 'true', changing this will lead to silent failures. See also:
https://logging.apache.org/log4j/2.x/manual/configuration.html#ConfigurationSyntax -->
<Configuration strict="true">
<!-- This defines a property to set the path for the cadenza web log file. By default it is set
to the Tomcat logs directory. If you want to override this path, you can set the
`CADENZA_LOG_PATH` environment variable. -->
<Properties>
<Property name="CADENZA_LOG_PATH">${sys:catalina.home}/logs</Property>
</Properties>
<!-- The appenders define where the output of the log goes, by default we log to the console
and to a rolling file. -->
<Appenders>
<Appender type="Console" name="console">
<Layout type="PatternLayout" pattern="%d{ISO8601} %-5p [%t] %-c - %m%n" />
</Appender>
<Appender
type="RollingFile"
name="delegate"
fileName="${env:CADENZA_LOG_PATH}/cadenza-web.log"
filePattern="${env:CADENZA_LOG_PATH}/cadenza-web-%d{yyyy-MM-dd}.%i.log">
<Layout type="PatternLayout" pattern="%d{ISO8601} %-5p [%t] %-c - %m%n" />
<Policies>
<!-- The SizeBasedTriggeringPolicy makes sure that individual files are never larger than the configured size.
If they grow bigger, they will be rolled over to a new file. The filename contains an index that will be
incremented. Together with the DefaultRolloverStrategy max files setting this limits the maximum amount
of space these log files can take. -->
<SizeBasedTriggeringPolicy size="50 MB" />
<!-- Together with the date pattern in the filePattern attribute of the Appender which has a minimal granularity
of days this means that the log file will roll over to a new file each day. -->
<TimeBasedTriggeringPolicy interval="1"/>
</Policies>
<!-- The value of the max attribute indicates how many files should be kept at most. Additional files will be
deleted automatically starting with the oldest one. -->
<DefaultRolloverStrategy max="20" />
</Appender>
</Appenders>
<!-- Now that we have defined where we will log things, we now configure _what_ will be logged -->
<Loggers>
<!-- By default, every library and every Cadenza subsystem should only log ERROR entries or worse.
This prevents a lot of unnecessary output.
Individual areas in Cadenza will (and can) be set to more verbose logging levels. -->
<Root level="ERROR">
<AppenderRef ref="console"/>
<AppenderRef ref="delegate"/>
</Root>
<!-- Spring is set to WARN to get a bit more actionable output -->
<Logger name="org.springframework" level="WARN" />
<!-- All Cadenza code starts with one of the following package prefixes and we set all of them
to the level WARN or higher. This should produce only log output that is actionable for an
administrator. -->
<Logger name="de.disy" level="WARN" />
<Logger name="gis.gisterm" level="WARN" />
<Logger name="net.disy" level="WARN" />
<!-- A few basic subsystems in Cadenza provide useful information at startup and we increase
the loglevel for them to INFO so we can see it. -->
<!-- Log Cadenza version information and encoding settings -->
<Logger name="net.disy.cadenza.platform.PlatformFactory" level="INFO" />
<!-- Log the Cadenza license -->
<Logger name="net.disy.cadenza.core.license.module.WebLicenseFactoryAdapter" level="INFO" />
<!-- Log the configuration format if it is specified -->
<Logger name="de.disy.cadenza.core.config.items.logging.CadenzaConfigurationFormatLogger" level="INFO" />
<!-- Below are logging configurations that are meant for admins to enable or disable using environment
variables. They are documented in a special format so they can show up in our admin docs. -->
<!-- tag::cadenza-logging[]
| `CADENZA_LOGLEVEL_OUTGOING_HTTP` | Set to `DEBUG` to log all outgoing HTTP requests such as WMS, WFS,
WMTS and similar requests.
WARNING: This will produce a lot of output and should not be used in production.
end::cadenza-logging[] -->
<Logger name="net.disy.lib.http.HttpRequestExecutor" level="${env:CADENZA_LOGLEVEL_OUTGOING_HTTP:-ERROR}" />
<!-- tag::cadenza-logging[]
| `CADENZA_LOGLEVEL_CLUSTER` | Set to `DEBUG` to log all messages exchanged between cluster nodes and
very detailed Apache Ignite logging.
WARNING: This will produce a lot of output and should not be used in production.
end::cadenza-logging[] -->
<Logger name="net.disy.cadenza.message.broker.ignite" level="${env:CADENZA_LOGLEVEL_CLUSTER:-ERROR}" /> <!-- this will also allow to see all the messages exchanged with given node -->
<Logger name="org.apache.ignite" level="${env:CADENZA_LOGLEVEL_CLUSTER:-ERROR}" />
</Loggers>
</Configuration>
Subsystem Loglevels
The following table lists environment variables with which you can set the log level for certain important subsystems.
By default, they will be set to ERROR, but you can override them to any of the following log4j2 log levels: TRACE, DEBUG, INFO, WARN, ERROR and FATAL.
Note that a lower log level will automatically include higher level log messages.
A message logged with level WARN will also be output if the log level is set to DEBUG for example.
One typical use case would be to switch a particular subsystem to DEBUG to get more output for diagnosing a problem.
| Environment Variable | Purpose | ||
|---|---|---|---|
|
Set to
|
||
|
Set to
|
JSON Logging
Cadenza includes the required log4j2 dependency to enable JSON format logging. See the Apache Log4j2 configuration page for more details on how to configure this.