I have a spring boot application using logback for logging and it is working normally. I have a change to implement which is to log a value on runtime in every error - warn log record. For example I want to append the request param to every log:
"User ID {} ", request.getHeader("userId") + // here comes the normal log.
I am planning to user:
@Autowired
private HttpServletRequest request;
To be able to catch the needed data. But how can I append this value to all error logs without adding toomuch code ( like using AOP or extended common class etc)