You are missing a call to context.updateLoggers() that should happen after the 
call to setLevel().

Ralph

On Jun 2, 2014, at 9:41 AM, Dave Trombley <[email protected]> wrote:

> 
>    Can someone explain to me why the following code does not produce any 
> output, and how to do this sort of thing properly? Documentation on the log4j 
> website is somewhat less than helpful here...
> 
>        LoggerContext context = (LoggerContext)LogManager.getContext();
>        Configuration configuration = context.getConfiguration();
> configuration.getLoggerConfig(LogManager.ROOT_LOGGER_NAME).setLevel(Level.INFO);
> 
>        LOGGER = LogManager.getLogger(Startup.class);
> 
>        LOGGER.log(Level.INFO, "Hello");
> 
> 
>   Thanks,
>     -David
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to