Personal tools
You are here: Home CinnamonServer Administration Server side logging

Server side logging

How to configure the Logback logger in the Cinnamon server.

The Cinnamon CMS server uses Logback as its preferred logging mechanism. Other logging frameworks (log4j) are only used if an underlying library is incapable of SLF4J-compatible logging.

The configuration file is located in CINNAMON_HOME_DIR / logback.xml (or elsewhere, depending on your cinnamon_config.xml). If you want to know more about how the general configuration options, please consult the Logback manual.

Session based logging

Cinnamon has a feature called session based logging where everything that is identified as belonging to one user's session is logged into a special log file. You can enable it by using the element

 <use_session_logging>true</use_session_logging>

in the cinnamon_config.xml file.

Have a look at the following excerpt of a logback.xml configuration file:

<appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
   <discriminator>
        <Key>session</Key>
        <DefaultValue>unknown_session</DefaultValue>
  </discriminator>
  <sift>
  <appender name="FILE-${session}" class="ch.qos.logback.core.FileAppender">
    <File>${logFolder}/${session}.log</File>
    <Append>true</Append>
    <Layout class="ch.qos.logback.classic.PatternLayout">
          <Pattern>%-4relative [%thread] %-5level %mdc{user} %mdc{repo} %logger{35} %L - %msg%n</Pattern>
     </Layout>
    </appender>
  </sift>
</appender>

  <root level="DEBUG">
    <appender-ref ref="SIFT" />
    <appender-ref ref="FILE" />
  </root>

The important items are the discriminator keys. Those determine how the files are created and named. The key element must have one of the following values:

  • user
    creates a user.log with all actions of this user - you may use this safely if there is only one repository installed.
  • session
    creates a $sessionId.log (for example: 1.log, 5234324.log) with the current session's database id. You will get a lot of log files this way.
  • repo
    creates one log (for example: cmn_test.log) for each repository. May be useful to track down bugs that only appear in one repository but where you do not know which user is responsible.
  • repoUser
    creates a log with $repositoryName__$username (for example: cmn_test__admin.log), collecting all actions of a user.
  • repoUserSession
    creates a log for each session of a user in a repository. This may be useful if you have multithreaded clients or background processes which use the same credentials but use forkSession to access a repository with multiple sessions.

Limitations

Not all actions can be directly attributed to a session or a user, for some commands to the server are made by unauthenticated guests (for example: login attempts) or the logging occurs outside the scope of the session handling code (for example: startup or shutdown procedures). You should have a general log running for those occasions, preferably one which has a sensible rollover policy and maximum size configured.

 

Document Actions