Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-4488

DiagnosticsLoggerManager is incompatible with com.atlassian.logging.log4j.layout.JsonLayout on Jira 8

    Details

    • Type: Bug
    • Status: Done (View Workflow)
    • Priority: L3
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 6.7.0
    • Component/s: None
    • Labels:
      None
    • Sprint:
      SR4J Sprint 81, SR4J Sprint 82, SR4J Sprint 83
    • Critical Points:
      2.3

      Description

      Steps to reproduce:
      1. Add the following log4j configuration:

      log4j.appender.jsonfilelog=com.atlassian.jira.logging.JiraHomeAppender
      log4j.appender.jsonfilelog.File=atlassian-jira-json.log
      log4j.appender.jsonfilelog.layout=com.atlassian.logging.log4j.layout.JsonLayout
      log4j.appender.jsonfilelog.layout.FilteredFrames=@jira-filtered-frames.properties
      
      log4j.logger.com.onresolve = DEBUG, filelog, jsonfilelog
      

      2. Add a listener triggered on issue creation on all projects which simply logs something:

      log.warn("testing")
      

      3. Create a new issue.
      4. The log will not be added to `atlassian-jira-json.log` and you will instead find a stacktrace like this in the main log file:

      java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.util.LinkedHashSet)
      	at org.codehaus.jackson.impl.JsonGeneratorBase._writeSimpleObject(JsonGeneratorBase.java:557)
      	at org.codehaus.jackson.impl.JsonGeneratorBase.writeObject(JsonGeneratorBase.java:317)
      	at org.codehaus.jackson.JsonGenerator.writeObjectField(JsonGenerator.java:1090)
      	at com.atlassian.logging.log4j.layout.JsonLayout.writeExtFieldsFromMap(JsonLayout.java:479)
      	at com.atlassian.logging.log4j.layout.JsonLayout.writeExtFieldsFromMap(JsonLayout.java:463)
      	at com.atlassian.logging.log4j.layout.JsonLayout.writeExtFieldsFromMap(JsonLayout.java:463)
      	at com.atlassian.logging.log4j.layout.JsonLayout.writeExtFields(JsonLayout.java:452)
      	at com.atlassian.logging.log4j.layout.JsonLayout.writeFields(JsonLayout.java:300)
      	at com.atlassian.logging.log4j.layout.JsonLayout.formatWithEnv(JsonLayout.java:177)
      	at com.atlassian.logging.log4j.layout.JsonLayout.format(JsonLayout.java:158)
      	at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:310)
      	at org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java:276)
      	at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
      	at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
      	at com.atlassian.jira.logging.JiraHomeAppender.doAppend(JiraHomeAppender.java:206)
      	at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:69)
      	at org.apache.log4j.Category.callAppenders(Category.java:219)
      	at org.apache.log4j.Category.forcedLog(Category.java:402)
      	at org.apache.log4j.Category.error(Category.java:316)
      	at org.apache.log4j.Category$error$6.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
      	at com.onresolve.scriptrunner.runner.AbstractScriptListener$_run_closure2.doCall(ListenerManagerImpl.groovy:245)
      

        Attachments

          Structure

            Activity

              People

              Assignee:
              mclark Matthew Clark
              Reporter:
              merdmann Marcin Erdmann
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Structure Helper Panel