Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-15610

Support json formatted logging via conf: add log4j-layout-template-json to 'server'



    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 9.0, 8.10
    • None
    • None


      JSON Formatted logging is becoming wide spread enough that it seems like we should support it as an option in Solr.

      Assuming we upgrade to log4j >= 2.14.0  (SOLR-15609) then this becomes possible for people to do by:

      1. downloading the log4j-layout-template-json.jar that corresponds with the lof4j version used by their solr version
      2. include the log4j-layout-template-json.jar in the (jetty) classpath via SOLR_OPTS (can't be loaded as a solr plugin because it needs to be used on startup)
      3. specify their own LOG4J_PROPS file that configures log4j to use a JsonTemplateLayout

      ..but steps #1 and #2 are a bit hairy.  Particularly step #1 as it means every time users upgrade solr they have to pay careful attention to if/when the log4j deps change.

      I would like to propose that we make this easier, by adding log4j-layout-template-json as a dependency for the "server" module, so that it is available out of the box when running solr – that way JSON logging can be enabled easily with a simple LOG4J_PROPS change.


        1. SOLR-15610.8x.patch
          14 kB
          Chris M. Hostetter
        2. SOLR-15610.patch
          15 kB
          Chris M. Hostetter
        3. SOLR-15610.patch
          13 kB
          Chris M. Hostetter

        Issue Links



              hossman Chris M. Hostetter
              hossman Chris M. Hostetter
              0 Vote for this issue
              5 Start watching this issue