On Tue, Aug 5, 2008 at 10:17 AM, Alex Karasulu <[EMAIL PROTECTED]> wrote:
> On Tue, Aug 5, 2008 at 3:39 AM, Eero Nevalainen <[EMAIL PROTECTED]
>> wrote:
> Hey I never tried activating debugging at runtime.  How's this done?

Here's an example using log4j

        // set up things, you would normally have this in your properties file
        ConsoleAppender console = new ConsoleAppender();
        console.setWriter(new OutputStreamWriter(System.out));
        console.setLayout(new SimpleLayout());
        Logger.getRootLogger().addAppender(console);

        // log only WARN and up
        Logger.getRootLogger().setLevel(Level.WARN);
        Logger.getLogger("foo").debug("Wont be logged");

        // crisis, let's log debug!
        Logger.getRootLogger().setLevel(Level.DEBUG);
        Logger.getLogger("foo").debug("Will be logged");

I something like this a lot. In the case of the Felix web console, you
can configure your logging using the web gui and config admin. Pretty
sweet.

/niklas

Reply via email to