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 2012/07/15 16:41:25 UTC
Bulk logging for 2.0?
Hi All,
I have many cases in 1.2 where I log "in bulk". The simplest example would
be to log all system properties.
Depending on the case, I care (or not) that all log entries in the bulk are
non-interlaced with other log entries (from other threads).
So I have cases where I log maps, lists, and arrays. With 1.2, I have to
have my own loops for create log entries.
Any thought of providing additional APIs to do this? Before I work on a
proposal, I'd like a feel for if this is out of scope for 2.0.
Thank you!
--
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Re: Bulk logging for 2.0?
Posted by Gary Gregory <ga...@gmail.com>.
On Jul 15, 2012, at 11:31, Ralph Goers <ra...@dslextreme.com> wrote:
> On Jul 15, 2012, at 7:41 AM, Gary Gregory wrote:
>
>> Hi All,
>>
>> I have many cases in 1.2 where I log "in bulk". The simplest example would be to log all system properties.
>>
>> Depending on the case, I care (or not) that all log entries in the bulk are non-interlaced with other log entries (from other threads).
>>
>> So I have cases where I log maps, lists, and arrays. With 1.2, I have to have my own loops for create log entries.
>>
>> Any thought of providing additional APIs to do this? Before I work on a proposal, I'd like a feel for if this is out of scope for 2.0.
>>
>> Thank you!
>
> You just need to create a custom Message. See MapMessage or ThreadDumpMessage for examples. You could also define a Message that has a put method to add items to it. When the message is rendered the rendering would format them however you want but essentially as one String, which is the only way to guarantee the lines stay together in the log.
I'll have to play with that idea. Thank you for the tip.
Gary
>
> Ralph
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: Bulk logging for 2.0?
Posted by Ralph Goers <ra...@dslextreme.com>.
On Jul 15, 2012, at 7:41 AM, Gary Gregory wrote:
> Hi All,
>
> I have many cases in 1.2 where I log "in bulk". The simplest example would be to log all system properties.
>
> Depending on the case, I care (or not) that all log entries in the bulk are non-interlaced with other log entries (from other threads).
>
> So I have cases where I log maps, lists, and arrays. With 1.2, I have to have my own loops for create log entries.
>
> Any thought of providing additional APIs to do this? Before I work on a proposal, I'd like a feel for if this is out of scope for 2.0.
>
> Thank you!
You just need to create a custom Message. See MapMessage or ThreadDumpMessage for examples. You could also define a Message that has a put method to add items to it. When the message is rendered the rendering would format them however you want but essentially as one String, which is the only way to guarantee the lines stay together in the log.
Ralph
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org