Skip to content

Add MDC log context for the specific interview a log is for #416

Description

@BryceStevenWilley

Somehow skipped over this and how useful it would be when adding the server, user, session, correlation, and request ones. Would need to:

  • add a header to check for when new requests come in (likely efsp-interview-id)
  • add an MDC value for it (INTERVIEW_ID = "interviewId";)
  • add it to the logger output (%X{interviewId}) for both paper trail and locally

Files to edit:

  • public static final String CORRELATION_ID = "correlationId";
  • <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [server=%X{serverId}] [user=%X{userId}] [session=%X{sessionId}] [corr=%X{correlationId}] [req=%X{requestId}] [op=%X{operation}]%n %-5level %-35logger{35} - %msg %rEx%n</pattern>
    </encoder>
    </appender>
    <appender name="PerServer" class="edu.suffolk.litlab.efsp.server.logging.ServerSpecificAppender">
    <encoder>
    <Pattern>| %d{yyyy-MM-dd HH:mm:ss.SSS} | %X{serverId} | %X{userId} | %X{sessionId} | %X{correlationId} | %X{requestId} | %X{operation} | %thread | %-5level | %logger{40} |- %msg | %rEx |%n</Pattern>
    </encoder>
    </appender>
    <condition class="ch.qos.logback.core.boolex.ExpressionPropertyCondition">
    <expression>isDefined("PAPERTRAIL_HOST")</expression>
    </condition>
    <if>
    <then>
    <appender name="SYSLOG-TLS" class="com.papertrailapp.logback.Syslog4jAppender">
    <layout class="ch.qos.logback.classic.PatternLayout">
    <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [server=%X{serverId}] [user=%X{userId}] [session=%X{sessionId}] [corr=%X{correlationId}] [req=%X{requestId}] [op=%X{operation}] %-5level %logger{35}: %m%n%rEx</pattern>

Metadata

Metadata

Assignees

Labels

opsOperations, i.e. production running

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions