Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-26453

Add basic config for log4j2 JSON logging

    XMLWordPrintable

    Details

      Description

      Add to the platform the basic configuration needed for JSON logging through log4j2:

      Add the following jars

      jackson-annotations-2.8.0
      jackson-core-2.8.7.jar
      jackson-databind-2.8.7.jar

      Add the following RollingFile section in log4j2.xml:

      <RollingFile name="JSON-FILE" fileName="${sys:nuxeo.log.dir}/server-json.log" append="true"
               filePattern="${sys:nuxeo.log.dir}/server-json-%d{yyyy-MM-dd}.log">
          <JSONLayout compact="true" eventEol="true"/>
          <PatternLayout pattern="%highlight{%d %p [%c] - &lt;%m&gt;}%n"/>
          <Policies>
              <OnStartupTriggeringPolicy />
              <SizeBasedTriggeringPolicy size="10 MB"/>
              <TimeBasedTriggeringPolicy />
          </Policies>
          <DefaultRolloverStrategy max="5" compressionLevel="9">
              <Delete basePath="${sys:nuxeo.log.dir}" maxDepth="2">
                  <IfFileName glob="*/*.log.gz" />
                  <IfLastModified age="7d" />
              </Delete>
          </DefaultRolloverStrategy>
      </RollingFile>
      

      To activate it in production, we would also add the following section in log4j2.xml:

      <Root level="warn">
        <AppenderRef ref="CONSOLE" />
        <AppenderRef ref="FILE" />
        <AppenderRef ref="JSON-FILE" />
      </Root>
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: