[slf4j-user] Expressions on log statements to avoid log guading

Chris Pratt thechrispratt at gmail.com
Thu Sep 12 00:23:51 CEST 2013


At the moment, you still have to use Anodyzed as a wrapper around SLF4j,
but I'm planning on trying to integrate it better when I get the time.  At
this point, I don't know when that will be since time always seems too
short for all the things I'd like to get done.
  (*Chris*)


On Wed, Sep 11, 2013 at 3:05 PM, Dario Garcia <dario.garcia at 10pines.com>wrote:

> Hi everyone,
>
> Does anyone knows if it's possible to use expressions on log variables to
> avoid log guarding for costly operations?
>
> For example, asuming that "receivedObject.getCurrentState()" is a costly
> operation, what I'm doing now in my code is something like this:
>
>
> if(LOG.isDebugEnabled()){
>    LOG.debug("The received object has invalid state: {}",
> receivedObject.getCurrentState() );
> }
>
>
>  So I can avoid the cost of that operation when debug isn't enabled.
> I would like to have some kind of expressions to avoid the extra IF:
>
>
> LOG.debug("The received object has invalid state: {1.currentState}",
> receivedObject)
>
>
> I've seen on previous mail from Chris Pratt that someone suggested the
> format from anodyzed, but I couldn't find documentation whether this was
> implemented or not :
>
> "...I would love to merge the formatter from
> http://code.google.com/p/anodyzed directly into a pluggable SLF4j..."
>
> Is this implemented or is it going to be implemented? Are there any
> alternatives to what I'm doing?
>
> Thanks in advance for your responses
>
> --
> *Darío García*
> Agile Software Development
> +54 (911) 6336-3707
> *Office: +54 - 011 - 4311-8404*
> dario.garcia at 10pines.com
>
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20130911/f6b3d54d/attachment.html>


More information about the slf4j-user mailing list