[slf4j-dev] Benefits of Message objects?

Ceki Gülcü ceki at qos.ch
Fri Sep 9 23:54:17 CEST 2011


Hi everyone,

After reading this thread, I am still trying to establish whether the
Message interface is needed especially compared to the following
approach:

StructuredData sd = new StructuredData(..., aMap, ...);
logger.info("{}", sd);

Granted, the above is not intuitive but other than that:

1) it allows filtering on parameter type

2) formatting of StructuredData is done lazily using the toString
method of StructuredData

3) it requires no changes to SLF4J

I do not wish to be obtuse and I apologize if this question was asked
previously. Unfortunately, I don't recall the answer. Seriously, what
is wrong with logger.info("{}", sd) ?

Cheers,
-- 
Ceki


More information about the slf4j-dev mailing list