Hi Nestor -
     I had to do something similar for a servlet I was writing recently - as
part of the servlet, I declare a logger which is then used to get all the
loggers that have been configured, and then show which appenders are
attached to which loggers.  The main function which I used to get all the
configured loggers and their appenders is like this:

    private void showLoggers(Logger mainLogger, PrintWriter out) {
        // get all the loggers
        Enumeration allLoggers = mainLogger.getLoggerRepository
().getRootLogger().getLoggerRepository().getCurrentLoggers();
        while (allLoggers.hasMoreElements()){
            Logger logger = (Logger)allLoggers.nextElement();
            // only show loggers that have appenders attached to them
            try {
                if ( logger.getAllAppenders().hasMoreElements() ) {
                    printLoggingSummary(logger, out);
                }
            } catch (Exception e) {
                System.out.println("in showLoggerst().... " +
e.getStackTrace() + "\nMessage: " + e.getMessage() );
            }
        }
    }

Hopefully this helps steer you in the right direction.

~ David

On Dec 31, 2007 3:25 PM, Néstor Boscán <[EMAIL PROTECTED]> wrote:

> Hi
>
> Is there a way to get a list of all configured loggers?
>
> Regards,
>
> Néstor Boscán
>



-- 
Best Regards,
David Killeffer

Reply via email to