Logging API request headers

cancel
Showing results for 
Search instead for 
Did you mean: 
lnedasco
Member II

Logging API request headers

Hello,

We have an application that uses tracking ids throughout multiple services. This id is also sent to Alfresco using headers.

We would like to log this id in some way. I searched the docs but could not find anything how to log (all) headers of the requests (e.g. when a node is added).

Is this possible, or is there some other way we could get this id to show up in the Alfresco logs?

Thanks.

Kind regards,
LNE

1 Reply
afaust
Master

Re: Logging API request headers

There is no default feature to map arbitrary HTTP headers into the logging context, but you could simply implement an extension with a WebFilter / ServletFilter to map your headers to the log4j MDC, and adapt the logging format via custom-log4j.properties to include those MDC variables.