Gary,

You could do this with Log4j2 if you desire.  Remember, Log4j2 supports 
Messages. So just create a MapMessage with your system properties and then 
create an Appender that writes a separate line for each property.  You can do 
the same thing for Lists or anything else you want to create a specific Message 
for.

Ralph



On May 4, 2012, at 5:08 AM, Gary Gregory wrote:

> On Fri, May 4, 2012 at 4:48 AM, Christian Grobmeier <[email protected]> 
> wrote:
> Today it is like:
> 
> if(logger.isDebugEnabled) {
>  logger.debug("Hello");
>  logger.debug("Another");
>  logger.debug("Third");
> }
> 
> all the logging methods return void, like:
> void debug(String message);
> 
> Of course there is already the substition feature which eases life.
> But what about doing?
> 
> if(logger.isDebugEnabled) {
>  logger.debug("Hello").debug("Another").debug("Third");
> }
> 
> It would be also nice, I guess.
> 
> Wdyt?
> 
> This specific example is not motivation enough for me to see a fluent API. 
> But I do know some people love it. There is also a small performance hit to 
> take on each call then because an object must be returned from all method 
> calls which may not be used. One of the goals IMO is to be fast. Adding 
> fluency to the API does not give the ability to a programmer to opt out of 
> this "feature".
> 
> What I DO need though is bulk logging where I can pass in an array of 
> messages:
> 
> logger.debug(List<?>) (or Collection?)
> logger.debug(Object[])
> logger.debug(Properties)
> 
> For example, I'd like to be able to do:
> 
> logger.debug(System.getProperties());
> 
> and have it log one entry per property. I am not sure what the format of each 
> entry is but a sensible default can be provided.
> 
> Gary
> 
> Cheers
> Christian
> 
> --
> http://www.grobmeier.de
> https://www.timeandbill.de
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 
> 
> -- 
> E-Mail: [email protected] | [email protected] 
> JUnit in Action, 2nd Ed: http://bit.ly/ECvg0
> Spring Batch in Action: http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

Reply via email to