logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: ConversionPattern per Priority (ConsoleAppender)
Date Tue, 11 Jan 2011 06:03:54 GMT
The easiest way would be to write your own Layout that delegates to encapsulated layouts (possibly
instances of PatternLayout or EnhancedPatternLayout) depending on the level.  Log parsing
tools would likely be baffled by formats that change every logging event, so you might want
to design your patterns so they are layout similarly.  For example, you might add a literal
"(?:?)" into the INFO pattern where "(%F:%L)" appears in the ERROR record.


On Jan 10, 2011, at 2:53 AM, ysbn wrote:

> Hi, I'm using ConsoleAppender and I want to set different "ConversionPattern" for each
Priority level.
> For example: INFO records will use pattern: %d %5p - %m%n
> and ERROR records will use pattern: %d %5p (%F:%L) - %m%n
> How can this be done?
> Thanks! 
> View this message in context: ConversionPattern per Priority (ConsoleAppender)
> Sent from the Log4j - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message