Closed BravinR closed 2 months ago
2024-06-15 10:00:00.000 INFO log_level="INFO" --- [thread="http-nio-8080-exec-1", httpMethod="GET", httpRequestURI="/api/resource", X-Request-ID="123e4567-e89b-12d3-a456-426614174000"] [http-nio-8080-exec-1] com.example.logging.LoggingInterceptor : START requestId=123e4567-e89b-12d3-a456-426614174000 method=GET uri=/api/resource
logging pattern configuration using
Components:
%d{yyyy-MM-dd HH:mm:ss.SSS}
: Date and time in the formatyyyy-MM-dd HH:mm:ss.SSS
.${LOG_LEVEL_PATTERN:%5level}
: Log level with a minimum width of 5 characters, using a custom variableLOG_LEVEL_PATTERN
if defined.log_level="%level"
: The log level again, enclosed in quotes.${PID:- }
: Process ID, if available, otherwise a space.---
: A static string separator.[thread="%thread"
: Name of the thread that logs the message.httpMethod="%X{httpMethod:-null}"
: HTTP method from the MDC (Mapped Diagnostic Context) or null if not available.httpRequestURI="%X{httpRequestURI-null}"
: HTTP request URI from the MDC or null if not available.X-Request-ID="%X{requestId:-null}"]
: X-Request-ID from the MDC or null if not available.[%15.15t]
: Thread name truncated to 15 characters.%-40.40logger{39}
: Logger name, with a minimum width of 40 characters, truncated to 39 characters if longer.: %replace(%msg){'\r\n|\n', '\u2028'}
: The log message, replacing new line characters with Unicode line separator.%replace(%Exception){'\r\n|\n', '\u2028'}
: The exception stack trace, replacing new line characters with Unicode line separator.%nopex
: Prevents evaluation of exception output (used to avoid recursion issues in logging).