|
Re: Does someone know how to add a custom to logger MDC [message #1841084 is a reply to message #1841080] |
Mon, 03 May 2021 12:38 |
|
Hi Seydou
The fact that you see "group=DefaultUserGroup" in your log output indicates that the MainGroupContextValueProvider is active and is correctly registered in your CustomServerRunContext. That ISession.CURRENT.get() is always null can only mean that the code is not executed in the context of a session.
I suspect that in your case, the order of the two lines in CustomServerRunContext#interceptCallableChain needs to be changed:
@Replace
public class CustomServerRunContext extends ServerRunContext {
@Override
protected <RESULT> void interceptCallableChain(final CallableChain<RESULT> callableChain) {
super.interceptCallableChain(callableChain); // <-- call this first!
callableChain.add(new DiagnosticContextValueProcessor(BEANS.get(MainGroupContextValueProvider.class)));
}
}
The session itself is also handled by one of the processors in the chain (see the default implementation). If you add your own processor first, the particular processor that spans the session context is not active yet. By adding the default Scout processors first, you should be able to access the session as expected.
Regards,
Beat
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03449 seconds