Noted when reviewing implementation of Tomcat.silence() in relation to Tomcat unit tests. Currently Tomcat.addContext() is implemented as following: [[[ public Context addContext(Host host, String contextPath, String contextName, String dir) { silence(host, contextPath); Context ctx = createContext(host, contextPath); ctx.setName(contextName); ctx.setPath(contextPath); ctx.setDocBase(dir); ctx.addLifecycleListener(new FixContextListener()); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; } ]]] The silence() call attempts to silence the logger for this Context by setting its log level to Level.WARNING. The following notes apply to Tomcat class of all current versions (Tomcat 7/8/9): 1. Note that in Tomcat unit tests the loggers are not silenced by default, as Tomcat.setSilent(boolean) is not called by Tomcat test code. => The silent(Host, contextPath) call shall respect the defaults and do not silence this logger if other loggers are not silenced. 2. The Engine name used in Tomcat.getLoggerName() is wrong. Tomcat.getEngine() uses "Tomcat" as the name, not "default". => It shall get the actual Engine instance from Host.getParent(). 3. Tomcat.getLoggerName() shall use the same logic as ContainerBase.logName() => It does not handle "" and null names correctly.
Fixed in 9.0.x for 9.0.0.M3 onwards.
Fixed in 8.0.x for 8.0.32 onwards.
Fixed in 7.0.x for 7.0.68 onwards.