I am using dropwizard 1.3.X and am trying to attach a unique correlation id generated in my servlet filter to my access logs.
I have tried several approaches but my access log still looks like this
127.0.0.1 - - [20/Aug/2020:18:15:56 +0000] "GET /v1/ HTTP/1.1" 404 43 "-" "RxNetty Client" 12
Is it possible for me to somehow override the default logging of dropwizard and attach custom attributes from the header?
I looked at the solution offered Here, but it seems to be outdated and RequestLogFactory is now an interface. I am not sure if implementing it would be the right thing to do.
my yaml config file looks like this:
server:
type:
applicationContextPath: /
adminContextPath: /
connector:
type:
port:
logging:
level: INFO
appenders:
- type: console
threshold: ALL
target: stdout
logFormat: "%d{dd/MMM/yyyy:HH:mm:ss} [%thread] %X{Correlation-ID} %-5level %logger{36} - %msg%n"