String path = oname.getKeyProperty("path");
Server server = ServerFactory.getServer();
Service service = server.findService(serviceName);
StandardEngine engine = (StandardEngine) service.getContainer();
if (hostName == null) { // if logger's container is Engine
Logger logger = engine.getLogger();
Container container = logger.getContainer();
if (container instanceof StandardEngine) {
String sname =
((StandardEngine)container).getService().getName();
if (sname.equals(serviceName)) {
engine.setLogger(null);
}
}
} else if (path == null) { // if logger's container is Host
StandardHost host = (StandardHost) engine.findChild(hostName);
Logger logger = host.getLogger();
Container container = logger.getContainer();
if (container instanceof StandardHost) {
String hn = ((StandardHost)container).getName();
StandardEngine se =
(StandardEngine) ((StandardHost)container).getParent();
String sname = se.getService().getName();
if (sname.equals(serviceName) && hn.equals(hostName)) {
host.setLogger(null);
}
}
} else { // logger's container is Context
StandardHost host = (StandardHost) engine.findChild(hostName);
path = getPathStr(path);
StandardContext context = (StandardContext) host.findChild(path);
Logger logger = context.getLogger();
Container container = logger.getContainer();
if (container instanceof StandardContext) {
String pathName = ((StandardContext)container).getName();
StandardHost sh =
(StandardHost)((StandardContext)container).getParent();
String hn = sh.getName();;