Re: Cayene logging:

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Jun 07 2003 - 18:39:43 EDT

  • Next message: Andrus Adamchik: "Modeler Update"

    I think it is a good idea. Once implemented we need to test it in
    different environemnts though (say, standalone and web container)

    Andrus

    > Andrus Adamchik wrote:
    >> All you need is to call this on startup:
    >>
    >> Configuration.configureCommonLogging(null);
    >>
    >> (Need to document this trick...)
    >
    > This seems to come up quite often, so I thought it would be more
    > user-friendly to find out whether log4j has already been initialized and
    > just act accordingly. After some searching I found something that might
    > do the trick:
    >
    > public class LoggerTest
    > {
    > static Logger log = Logger.getLogger(LoggerTest.class);
    >
    > public static void main(String[] args)
    > {
    > Logger root = Logger.getRootLogger();
    > Enumeration e = root.getAllAppenders();
    >
    > if (e.hasMoreElements())
    > {
    > log.info("logging already configured :)");
    > // just set isLoggingConfigured and proceed
    > }
    > else
    > {
    > // configure log4j as usual; the file is renamed so that //
    > log4j doesn't automatically load it for this test
    >
    > PropertyConfigurator.configure("src/log4j.properties.disabled");
    > log.info("logging configured manually!");
    > }
    > }
    >
    > Good idea?
    >
    > Holger



    This archive was generated by hypermail 2.0.0 : Sat Jun 07 2003 - 18:39:44 EDT