I’d recommend taking a look at the usage of LogMdc class that is used to add properties to MDC. In the web module, it is used in the CubaVaadinServletService.
Implement CustomVaadinServletService that extends CubaVaadinServletService
In order to use CustomVaadinServletService you need to extend CubaApplicationServlet
import com.haulmont.cuba.web.sys.CubaApplicationServlet;
import com.vaadin.server.DeploymentConfiguration;
import com.vaadin.server.ServiceException;
import com.vaadin.server.VaadinServletService;
public class CustomApplicationServlet extends CubaApplicationServlet {
@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
throws ServiceException {
VaadinServletService service = new CustomVaadinServletService(this, deploymentConfiguration);
if (classLoader != null) {
service.setClassLoader(classLoader);
}
service.init();
return service;
}
}
Register CustomApplicationServlet in web/WEB-INF/web.xml