General configuration file structure

Basically, the logback configuration file consists of two types of elements: Appenders and Loggers. Appenders are log output channels, they define where logged information is written to - for example to the console output window or a file. Logger elements allow to specify, per application module, the level of detail which will be used for logging.

Configured Appenders

The default configuration defines three different Appenders to handle log information:

There are a number of other possible Appenders for LogBack. Please see the corresponding section of the LogBack manual for more information.

Changing the log level

The log level can be defined in five stages:

Each of the log levels includes outputs of the 'heavier' log level. In log level 'info', for example, warnings and errors are also logged.

The log level can be specified generally or, if needed, by application module. The general setting can be defined by configuring the so called root logger:

<root level="error">

This general setting can be overriden by specific Loggers, which specify the package name. For example, log messages coming from Cryptshare Server are logged with detail level 'info':

<logger name="com.befinesolutions.cryptshare" 
        level="info" />

Adjusting the log archiving

Both Appenders FILE_DEFAULT and FILE_ERROR (see above) are configured to use an automatic archiving with rotation. After a time interval, or after exceeding a certain size limit, the currently active log file 'cryptshare.log' or 'cryptshare_error.log' is moved and stored as ZIP archive. Afterwards, the log file will be created again.

The time interval can be configured using the 'interval' element. Possible values are: year, month, day or hour. For example, the configuration

<interval>day</interval>
<maxFileSize>50MB</maxFileSize>

specifies that a new log file is created every new day or be exceeding 50MB, whichever occurs first.

Additionally it can be specified under which confitions old archives are removed. The element 'maxHistory' specifies the amount, 'totalSizeCap' the maximum total size of all archives. For example:

<maxHistory>10</maxHistory>
<totalSizeCap>10MB</totalSizeCap>

Regardless of these settings, at least one archive will be kept.