On Fri, May 4, 2012 at 2:08 PM, Gary Gregory <[email protected]> wrote:
> On Fri, May 4, 2012 at 4:48 AM, Christian Grobmeier <[email protected]>
> 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".

I agree we must be fasted. But I was not sure my proposal is slow. So
i made a little performance test, which might not be representative,
but shows the direction.

Code:
for (int i = 0; i < 1000000; i++) {
            logger.fatal("Hallo World debug")
            .fatal("Hallo World debug")
            .fatal("Hallo World debug")
            .fatal("Hallo World debug")
            .fatal("Hallo World debug");
        }

respective the "traditional" way without fluent. My guess was it just
differs for a few seconds.

Classic way: Total: 332779
Fluent way: Total: 369666

Ok thats a lot of output, but log4j probably runs in a huge
environments. In my case above I need 35 seconds more just because of
a little syntax coolness. --i am surprised and take my idea back
now...

> What I DO need though is bulk logging where I can pass in an array of
> messages:

Ralph said it, here is a nice link with example:
https://people.apache.org/~rgoers/log4j2/manual/messages.html

Cheers,
Christian


>
> 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



-- 
http://www.grobmeier.de
https://www.timeandbill.de

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to