We have a method triggered in case the session ID gets changed. This method essentially allows our logger to pick up the change as soon as it happens, so any logging output is now against the new session ID.
In servlet API 3.0 and earlier we used
Since Servlet API 3.1 you can use
Implementations of this interface are notified when an HttpSession's ID changes. To receive notification events, the implementation class must be configured in the deployment descriptor for the web application, annotated with WebListener or registered by calling an addListener method on the ServletContext.