You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2015/10/01 02:15:07 UTC
Pattern layout and Markers
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
Re: Pattern layout and Markers
Posted by Gary Gregory <ga...@gmail.com>.
I did %equals, I'll take a look at %notEmpty...
On Wed, Sep 30, 2015 at 5:15 PM, Gary Gregory <ga...@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
Re: Pattern layout and Markers
Posted by Gary Gregory <ga...@gmail.com>.
So, silly example:
%notEmpty{<%marker>%msg</%marker>}
would only print if marker AND msg are not empty?
Gary
On Wed, Sep 30, 2015 at 7:45 PM, Ralph Goers <ra...@dslextreme.com>
wrote:
> Topic 1
>
> This is quite a common use case. I have no problem with %equals but
> %notEmpty{[%marker]} would be nicer for this use case - it would mean don’t
> print anything if the variables in the pattern are empty strings.
>
> Ralph
>
> On Sep 30, 2015, at 5:15 PM, Gary Gregory <ga...@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
Re: Pattern layout and Markers
Posted by Gary Gregory <ga...@gmail.com>.
Review away! ;-)
Gary
On Fri, Oct 2, 2015 at 8:55 AM, Ralph Goers <ra...@dslextreme.com>
wrote:
> Mikael, we generally only create code branches when we have things that we
> would like feedback on before we commit them to master. Frankly, I do my
> code reviews using the emails from git. At least 80% of Gary’s commits are
> just code “cleanups” so are easy to look at - he is pretty good at
> separating those from actual code modifications.
>
> Ralph
>
> On Oct 2, 2015, at 7:08 AM, Mikael Ståldal <mi...@magine.com>
> wrote:
>
> I think it will be easier to do code review if you make a branch in Git,
> rather than uploading a diff.
>
> On Fri, Oct 2, 2015 at 1:05 AM, Gary Gregory <ga...@gmail.com>
> wrote:
>
>> Feedback please: https://issues.apache.org/jira/browse/LOG4J2-1146
>>
>> Note the addition of the isVariable() method.
>>
>> Gary
>>
>> On Wed, Sep 30, 2015 at 7:45 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>>
>>> Topic 1
>>>
>>> This is quite a common use case. I have no problem with %equals but
>>> %notEmpty{[%marker]} would be nicer for this use case - it would mean don’t
>>> print anything if the variables in the pattern are empty strings.
>>>
>>> Ralph
>>>
>>> On Sep 30, 2015, at 5:15 PM, Gary Gregory <ga...@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
>>
>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> mikael.staldal@magine.com
> Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>
>
>
--
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
Re: Pattern layout and Markers
Posted by Gary Gregory <ga...@gmail.com>.
Well, it's in Git master now ...
Gary
On Mon, Oct 5, 2015 at 1:00 AM, Mikael Ståldal <mi...@magine.com>
wrote:
> Yes, and this is such a case (since Gary wrote "Feedback please"), isn't
> it?
>
> On Fri, Oct 2, 2015 at 5:55 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
>
>> Mikael, we generally only create code branches when we have things that
>> we would like feedback on before we commit them to master. Frankly, I do my
>> code reviews using the emails from git. At least 80% of Gary’s commits are
>> just code “cleanups” so are easy to look at - he is pretty good at
>> separating those from actual code modifications.
>>
>> Ralph
>>
>> On Oct 2, 2015, at 7:08 AM, Mikael Ståldal <mi...@magine.com>
>> wrote:
>>
>> I think it will be easier to do code review if you make a branch in Git,
>> rather than uploading a diff.
>>
>> On Fri, Oct 2, 2015 at 1:05 AM, Gary Gregory <ga...@gmail.com>
>> wrote:
>>
>>> Feedback please: https://issues.apache.org/jira/browse/LOG4J2-1146
>>>
>>> Note the addition of the isVariable() method.
>>>
>>> Gary
>>>
>>> On Wed, Sep 30, 2015 at 7:45 PM, Ralph Goers <ralph.goers@dslextreme.com
>>> > wrote:
>>>
>>>> Topic 1
>>>>
>>>> This is quite a common use case. I have no problem with %equals but
>>>> %notEmpty{[%marker]} would be nicer for this use case - it would mean don’t
>>>> print anything if the variables in the pattern are empty strings.
>>>>
>>>> Ralph
>>>>
>>>> On Sep 30, 2015, at 5:15 PM, Gary Gregory <ga...@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
>>>
>>
>>
>>
>> --
>> [image: MagineTV]
>>
>> *Mikael Ståldal*
>> Senior software developer
>>
>> *Magine TV*
>> mikael.staldal@magine.com
>> Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com
>>
>> Privileged and/or Confidential Information may be contained in this
>> message. If you are not the addressee indicated in this message
>> (or responsible for delivery of the message to such a person), you may
>> not copy or deliver this message to anyone. In such case,
>> you should destroy this message and kindly notify the sender by reply
>> email.
>>
>>
>>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> mikael.staldal@magine.com
> Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>
--
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
Re: Pattern layout and Markers
Posted by Mikael Ståldal <mi...@magine.com>.
Yes, and this is such a case (since Gary wrote "Feedback please"), isn't it?
On Fri, Oct 2, 2015 at 5:55 PM, Ralph Goers <ra...@dslextreme.com>
wrote:
> Mikael, we generally only create code branches when we have things that we
> would like feedback on before we commit them to master. Frankly, I do my
> code reviews using the emails from git. At least 80% of Gary’s commits are
> just code “cleanups” so are easy to look at - he is pretty good at
> separating those from actual code modifications.
>
> Ralph
>
> On Oct 2, 2015, at 7:08 AM, Mikael Ståldal <mi...@magine.com>
> wrote:
>
> I think it will be easier to do code review if you make a branch in Git,
> rather than uploading a diff.
>
> On Fri, Oct 2, 2015 at 1:05 AM, Gary Gregory <ga...@gmail.com>
> wrote:
>
>> Feedback please: https://issues.apache.org/jira/browse/LOG4J2-1146
>>
>> Note the addition of the isVariable() method.
>>
>> Gary
>>
>> On Wed, Sep 30, 2015 at 7:45 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>>
>>> Topic 1
>>>
>>> This is quite a common use case. I have no problem with %equals but
>>> %notEmpty{[%marker]} would be nicer for this use case - it would mean don’t
>>> print anything if the variables in the pattern are empty strings.
>>>
>>> Ralph
>>>
>>> On Sep 30, 2015, at 5:15 PM, Gary Gregory <ga...@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
>>
>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> mikael.staldal@magine.com
> Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>
>
>
--
[image: MagineTV]
*Mikael Ståldal*
Senior software developer
*Magine TV*
mikael.staldal@magine.com
Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com
Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
Re: Pattern layout and Markers
Posted by Ralph Goers <ra...@dslextreme.com>.
Mikael, we generally only create code branches when we have things that we would like feedback on before we commit them to master. Frankly, I do my code reviews using the emails from git. At least 80% of Gary’s commits are just code “cleanups” so are easy to look at - he is pretty good at separating those from actual code modifications.
Ralph
> On Oct 2, 2015, at 7:08 AM, Mikael Ståldal <mi...@magine.com> wrote:
>
> I think it will be easier to do code review if you make a branch in Git, rather than uploading a diff.
>
> On Fri, Oct 2, 2015 at 1:05 AM, Gary Gregory <garydgregory@gmail.com <ma...@gmail.com>> wrote:
> Feedback please: https://issues.apache.org/jira/browse/LOG4J2-1146 <https://issues.apache.org/jira/browse/LOG4J2-1146>
>
> Note the addition of the isVariable() method.
>
> Gary
>
> On Wed, Sep 30, 2015 at 7:45 PM, Ralph Goers <ralph.goers@dslextreme.com <ma...@dslextreme.com>> wrote:
> Topic 1
>
> This is quite a common use case. I have no problem with %equals but %notEmpty{[%marker]} would be nicer for this use case - it would mean don’t print anything if the variables in the pattern are empty strings.
>
> Ralph
>
>> On Sep 30, 2015, at 5:15 PM, Gary Gregory <garydgregory@gmail.com <ma...@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 <ma...@gmail.com> | ggregory@apache.org <ma...@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 <http://garygregory.wordpress.com/>
>> Home: http://garygregory.com/ <http://garygregory.com/>
>> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
>
>
>
> --
> E-Mail: garydgregory@gmail.com <ma...@gmail.com> | ggregory@apache.org <ma...@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 <http://garygregory.wordpress.com/>
> Home: http://garygregory.com/ <http://garygregory.com/>
> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
>
>
> --
>
>
> Mikael Ståldal
> Senior software developer
>
> Magine TV
> mikael.staldal@magine.com <ma...@magine.com>
> Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com <http://www.magine.com/>
>
> Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply email.
Re: Pattern layout and Markers
Posted by Mikael Ståldal <mi...@magine.com>.
I think it will be easier to do code review if you make a branch in Git,
rather than uploading a diff.
On Fri, Oct 2, 2015 at 1:05 AM, Gary Gregory <ga...@gmail.com> wrote:
> Feedback please: https://issues.apache.org/jira/browse/LOG4J2-1146
>
> Note the addition of the isVariable() method.
>
> Gary
>
> On Wed, Sep 30, 2015 at 7:45 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
>
>> Topic 1
>>
>> This is quite a common use case. I have no problem with %equals but
>> %notEmpty{[%marker]} would be nicer for this use case - it would mean don’t
>> print anything if the variables in the pattern are empty strings.
>>
>> Ralph
>>
>> On Sep 30, 2015, at 5:15 PM, Gary Gregory <ga...@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
>
--
[image: MagineTV]
*Mikael Ståldal*
Senior software developer
*Magine TV*
mikael.staldal@magine.com
Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com
Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
Re: Pattern layout and Markers
Posted by Gary Gregory <ga...@gmail.com>.
Feedback please: https://issues.apache.org/jira/browse/LOG4J2-1146
Note the addition of the isVariable() method.
Gary
On Wed, Sep 30, 2015 at 7:45 PM, Ralph Goers <ra...@dslextreme.com>
wrote:
> Topic 1
>
> This is quite a common use case. I have no problem with %equals but
> %notEmpty{[%marker]} would be nicer for this use case - it would mean don’t
> print anything if the variables in the pattern are empty strings.
>
> Ralph
>
> On Sep 30, 2015, at 5:15 PM, Gary Gregory <ga...@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
Re: Pattern layout and Markers
Posted by Mikael Ståldal <mi...@magine.com>.
I like %nonEmpty{[%marker]}
On Thu, Oct 1, 2015 at 4:45 AM, Ralph Goers <ra...@dslextreme.com>
wrote:
> Topic 1
>
> This is quite a common use case. I have no problem with %equals but
> %notEmpty{[%marker]} would be nicer for this use case - it would mean don’t
> print anything if the variables in the pattern are empty strings.
>
> Ralph
>
> On Sep 30, 2015, at 5:15 PM, Gary Gregory <ga...@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
>
>
>
--
[image: MagineTV]
*Mikael Ståldal*
Senior software developer
*Magine TV*
mikael.staldal@magine.com
Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com
Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
Re: Pattern layout and Markers
Posted by Ralph Goers <ra...@dslextreme.com>.
Topic 1
This is quite a common use case. I have no problem with %equals but %notEmpty{[%marker]} would be nicer for this use case - it would mean don’t print anything if the variables in the pattern are empty strings.
Ralph
> On Sep 30, 2015, at 5:15 PM, Gary Gregory <ga...@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 <ma...@gmail.com> | ggregory@apache.org <ma...@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 <http://garygregory.wordpress.com/>
> Home: http://garygregory.com/ <http://garygregory.com/>
> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
Re: Pattern layout and Markers
Posted by Gary Gregory <ga...@gmail.com>.
Looking back at the code and unit test, the intent is clear to print out
the FQN of the marker, so I'll leave that as is but add getFullName()
method.
I'll add a %markerName for the a converter that just does a getName().
Gary
On Thu, Oct 1, 2015 at 3:26 AM, Remko Popma <re...@gmail.com> wrote:
> 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 <ga...@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 <ga...@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
>>
>
>
--
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
Re: Pattern layout and Markers
Posted by Remko Popma <re...@gmail.com>.
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 <ga...@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 <ga...@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
>
Re: Pattern layout and Markers
Posted by Gary Gregory <ga...@gmail.com>.
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 <ga...@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