Enabling logs in Camunda

Hi,

I want to enable logs in camunda in tomcat or wildfly in specific pattern using logback.xml.

I have put logback-classic-1.1.2.jar , logback-core-1.1.2.jar in tomcat/lib and camunda-webapp/lib and engine-rest/lib and put the logabck.xml in WEB-INF/classes of both camunda and engine-rest webapp.

I am getting the logs of camunda in catalina.out but not in the pattern i mentioned in logback.xml.

Logback.xml is below:

Please let me know if I need to include something more.

<?xml version="1.0" encoding="UTF-8"?>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
    <pattern>{"type":"${TYPE}", "host":"${HOST}", "level":"%replace(%level){TRACE,DEBUG}", "neid":"${NEID}", "system":"${SYSTEM}", "time":"%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z', UTC}", "timezone":"${TIMEZONE}", "log":"%msg"}%n</pattern>
 </encoder>
    </appender>

    <!-- Send debug/info messages to a file-->
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>/opt/tomcat/test.log</file>
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
    <pattern>{"type":"${TYPE}", "host":"${HOST}", "level":"%replace(%level){TRACE,DEBUG}", "neid":"${NEID}", "system":"${SYSTEM}", "time":"%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z', UTC}", "timezone":"${TIMEZONE}", "log":"%msg"}%n</pattern>
</encoder>

    <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
    <FileNamePattern>/opt/tomcat/test.%i.log.zip</FileNamePattern>
    <MinIndex>1</MinIndex>
    <MaxIndex>10</MaxIndex>
    </rollingPolicy>

    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
    <MaxFileSize>2MB</MaxFileSize>
    </triggeringPolicy>
    </appender>
    <root level="DEBUG">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="FILE" />
    </root>

Regards,
Durga

Hi Durga,

What about the logback dependency?, please check
https://docs.camunda.org/manual/7.9/user-guide/logging/#example-using-logback

Best regards,
Yana

Hi Yana,

I did the same.

I have added logback.xml in camunda.war in WEB-INF/classes and added logback jars in WEB-INF/lib and jboss-deployment-structure.xml in META-INF.

Content of jboss-deployment:

  <exclusions>
  <module name="org.apache.commons.logging" />
  <module name="org.apache.log4j" />
  <module name="org.jboss.logging" />
  <module name="org.jboss.logging.jul-to-slf4j-stub" />
  <module name="org.jboss.logmanager" />
  <module name="org.jboss.logmanager.log4j" />
  <module name="org.slf4j" />
  <module name="org.slf4j.impl" />
</exclusions>

The same configurations works for tomcat but not in Jboss EAP or Wildfly.

Could you please let me know what more needs to be done.

Regards,
Durga

If you figure out the pattern, can you share it in: Camunda JSON Logging for shared engine: solved! so we can add it

Hi,

Can someone kindly provide an update.

Regards,
Durga