This is a problem that appears when embedding Tomcat into another
application. I observed it using Tomcat 6.0.24. 

I am using JDK logging and I would like to make sure that Tomcat JULI
does not modify logging runtime configuration that is not owned by
tomcat or web apps running on tomcat.

Here is what happens:

When adding a standard context and removing it again, it seems that JULI
resets or modifies otherwise the current logging configuration.

For example: This code:

<code>
logger.setLevel(Level.INFO);
logger.info("adding...");
StandardContext sc = addContext(c); 
logger.info("added");
System.out.println(logger.getLevel());          
logger.info("removing...");
removeContext(c,sc);
logger.info("removed");
System.out.println(logger.getLevel());
</code>

produces the following output:

</output>
INFO: adding...
08.02.2010 00:19:46 stuff.TomcatEmbedded main
INFO: added
INFO
08.02.2010 00:19:46 stuff.TomcatEmbedded main
INFO: removing...
null
</output>

in particular there is no further output after "removing...".

My Tomcat configuration applied when starting the embedded Catalina is
the one OOTB. Note that I am not specifying any JULI system properties.

So, I am wondering whether 

a) there is a way to configure JULI to not touch other loggers/handlers?
or
b) any other solution to my problem?


Thanks,
  Henning



Ps.: 

private static void removeContext(MyCatalina c, 
                        StandardContext sc) {
                Container ch = c.getServer().findService("Catalina")
                                .getContainer().findChild("localhost");
        ch.removeChild(sc);
}
        
private static StandardContext addContext(MyCatalina c) {
        File wc = new File("web1/WebContent");
        StandardContext sc = (StandardContext) c.createContext(
                "/web1",
                wc.getAbsolutePath()
        );
        File wd = new File("work");
        if (!wd.exists()) {
                wd.mkdir();
        }
        sc.setWorkDir(wd.getAbsolutePath());
        Container ch = c.getServer().findService("Catalina")
                        .getContainer().findChild("localhost");
        ch.addChild(sc);
        return sc;
}



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to