[logback-user] set outputPatternAsPresentationHeader programatically?

ceki ceki at qos.ch
Wed May 2 22:50:32 CEST 2012


On 02.05.2012 22:36, Andrzej Zadorozny wrote:
> Hello.
>
> Just letting you know that logback is awesome, and I like it a lot.
>
> I have a quick question regarding the new release.
> Is there a way to set 'outputPatternAsPresentationHeader' to 'false'
> programatically?

Sure. Get a hold of the PatternLayoutEncoder referenced by your appender 
(with the getEncoder() method) and invoke its 
setOutputPatternAsPresentationHeader() method with 'false' as parameter.

> I get the default pattern output to stdout even before I get my hands on
> the logger context:
> ILoggerFactory factory = LoggerFactory.getILoggerFactory();

The ConsoleAppender created by BasicConfigurator had this problem. It 
has been fixed in the source repository.

> So by the time I get to even begin to configure my own layout, the
> pattern of the default layout is already on the screen (and it's not
> even the pattern that I'm trying to configure).
>
> Also the link on the web page to "one-question survey" appears to be broken.

Thank you for the heads up. It's now corrected.

> I would like to suggest to leave that option as 'false' by default, and
> give the ability for people to turn it on when they need to.

That seems to be the majority opinion.

> Otherwise, logback is awesome, and I am looking forward to new features
> and enhancements.

> Thank you very much. :)

Much appreciated.

> CheerZ! :)
>


-- 
Ceki
http://twitter.com/#!/ceki


More information about the Logback-user mailing list