That's a very good point Henry. One of the advantages of slf4j is that it
avoids unnecessary string concatenations if used properly. By using
placeholders, slf4j builds the message string only if the log level is high
enough.

log.debug("This string contains {} placeholders and is only built if {}.",
2, "log level >= DEBUG")

We should encourage this usage and add it as a reference for future
contributors to the website.


On Tue, Sep 2, 2014 at 8:57 PM, Henry Saputra <[email protected]>
wrote:

> +1 awesome!
>
> For debug level we should start using slf4j  parameterized logging to
> avoid toString concatenation.
>
> - Henry
>
> On Tue, Sep 2, 2014 at 11:29 AM, Till Rohrmann <[email protected]>
> wrote:
> > Hi guys,
> >
> > just a short remark about the new logging system we use henceforth in
> > Flink. We replaced jcl interface with slf4j and the log4j logging
> framework
> > with logback. The only things which change for you is the generation of
> the
> > logger and the configuration.
> >
> > A logger with slf4j is created the following way:
> >
> > import org.slf4j.Logger;
> > import org.slf4j.LoggerFactory;
> >
> > Logger LOG = LoggerFactory.getLogger(Foobar.class)
> >
> > In the context of this rework, we also disentangled Flink from the
> actually
> > used logging framework. This means that we got rid off the LogUtils. A
> > consequence of this change is that the logger is exclusively configured
> via
> > the configuration file logback.xml. This file has to be placed in the
> > classpath or given as an environment property
> > -Dlogback.configurationFile=<file> to the JVM.
> >
> > Bests,
> >
> > Till
>

Reply via email to