logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: Pattern layout and Markers
Date Thu, 01 Oct 2015 10:26:38 GMT
About printing the Marker NAME instead of toString(), this sounds
reasonable (but to be honest I have never used Markers so I am no expert).

On Thu, Oct 1, 2015 at 8:30 AM, Gary Gregory <garydgregory@gmail.com> wrote:

> I was in the middle of addressing the easier of my topics by creating a
> new class MarkerNamePatternConverter and unit test when I looked at our
> current %marker docs that say:
>
> "The name of the marker, if one is present."
>
> So I'm going to call our current implementation a bug because we do NOT
> use the marker NAME, we use the toString() which IMO is meant for debugging
> and prints out the parent info in an ugly way. If we want to use toString()
> then I'll update my new MarkerNamePatternConverter as a new
> MarkerFullNamePatternConverter instead.
>
> Thoughts?
>
> Gary
>
>
>
> On Wed, Sep 30, 2015 at 5:15 PM, Gary Gregory <garydgregory@gmail.com>
> wrote:
>
>> Topic 1
>>
>> Let's say I want my logs to look like this:
>>
>> Date [thread] [loggerName] [MarkerName] Message
>>
>> But most of the time I do not have a marker so I end up with a lot of
>> lame looking log entries with [].
>>
>> Instead I'd rather see nothing.
>>
>> I could use a replace like this (not tested):
>>
>> %replace{[%marker]}{\[\]}{}
>>
>> But that seems 'expensive' and cryptic, the perfect combo ;-)
>>
>> Should we had a gadget so you can configure like:
>>
>> %equals{[%marker]}{[]}{}
>>
>> Which just does a String.equals instead of a RE match?
>>
>> Topic 2
>>
>> The toString on Markers are not nice when the marker has parents.
>> Therefore, I'd like to add %simpleMarker (like there is a
>> Class#getSimpleName). simpleMarker gets the name sans parents.
>>
>> Then I can say:
>>
>> %equals{[%simpleMarker]}{[]}{}
>>
>> Thoughts?
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>

Mime
View raw message