Folio logging approach meeting results (June 16, 2020)

Attendees

 Wayne SchneiderMarc JohnsonCraig McNallyZak BurkeAnton Emelianov (Deactivated)Taras Spashchenko , Oleksii PopovHongwei Ji

Meeting results

  • There should be common logging contract for Folio platform modules, which includes:

    • Logging entries should be json

    • The following properties should be included in each entry:

      • Log level
      • Timestamp

      • Message

      • Service name

      • Additionally if possible/applicable:

        • Stacktrace - plain text joined by \n symbol (for errors)

        • Tenant-id (from headers)

        • Request-id (from headers)

        • User-id (from headers)

  • Performance issues of log4j and class name in case of json logs should additionally investigated by Mikhail Fokanov

  • Modules should post logs to console (std-out) (as they already do)

  • Selection and deployment of logging stack (EFK, Splunk etc.) should be responsibility of hosting provider

  • EFK as an optional deployment artifact was considered, but wasn't accepted
  • There should be additional discussion on how to provide logging solution for dev envs.

  • Logging framework (aka logging library - new repository in folio space) should be created

    • It should leverage Slf4j for making it detached from logging implementation

    • It should contain default logging configuration, which can be overwritten by module which use the library
    • It should provide functionality of including tenant-id, request-id and user-id to log entries
  • The team which should be responsible for logging library is 

  • Logging of UI errors could be fruitful, but it is completely different topic and should handled separately

Background

RMB's current logging suggestions (https://github.com/folio-org/raml-module-builder#logging):

RMB uses the Log4J logging library. Logs that are generated by RMB will print all log entries in the following format: %d{dd MMM yyyy HH:mm:ss:SSS} %-5p %C{1} %X{reqId} %m%n

The default implementation of many RMB based API endpoints is a single call to PgUtil: https://github.com/folio-org/mod-circulation-storage/blob/v12.0.0/src/main/java/org/folio/rest/impl/CancellationReasonsAPI.java#L73-L115

All API calls of RMB based modules go through RMB.

Is it allowed to let RMB do all logging?

Is it required to change RMB from log4j to slf4j or is a log4j only solution that creates the correct JSON format allowed?