Migration to SLF4J and Logback

317 views
Skip to first unread message

Mathias Bogaert

unread,
Aug 26, 2010, 3:57:42 AM8/26/10
to play-framework
Hi,

Lots of other projects (Hibernate, JBoss, etc) have moved to SLF4J and
Logback, reasons outlined here: http://logback.qos.ch/reasonsToSwitch.html

I'd really like for Play! to also move, then logging becomes easier
and less bug-prone.

What does the group think?

Mathias Bogaert

GrailsDeveloper

unread,
Aug 26, 2010, 6:18:03 AM8/26/10
to play-framework
Hi

> I'd really like for Play! to also move, then logging becomes easier
> and less bug-prone.

What for bugs to you have with the play logging which based on log4j
and which would be solved by logback?

>
> What does the group think?

As far as I know log4j is fast and has the most appenders. The last
time I had a look on logback I saw that some parts are not free only
the core.

To SLF4J: I don't like APIs which are written for only 1
implementation. If you use it and change the implementing log-
framework it could happens that you loose log information. So that's
are reason I personally don't like SLF4J.

But this is my personal point of view and I don't have a problem with
changing to SLF4J or commons-logging, so every user could choose his
preferred log system.
The main argument against a switch is, that I think at the moment
there are bigger problems to solve (for example make 1.1 stable,
documentation...)

Niels

Mathias Bogaert

unread,
Aug 26, 2010, 8:12:48 AM8/26/10
to play-framework
Err. Parts of Logback that are not 'free'?? I can't find anything like
that. Read http://logback.qos.ch/license.html

SLF4J is written for multiple implementations. It has interfaces that
allow this.

Logback and SLF4J are more mature than Log4J and commons-logging IMO.

On Aug 26, 12:18 pm, GrailsDeveloper <opensourc...@googlemail.com>
wrote:

GrailsDeveloper

unread,
Aug 26, 2010, 9:51:41 AM8/26/10
to play-framework
Hi

On 26 Aug., 14:12, Mathias Bogaert <mathias.boga...@gmail.com> wrote:
> Err. Parts of Logback that are not 'free'?? I can't find anything like
> that. Readhttp://logback.qos.ch/license.html

You are right, currently all parts are opensource. Sorry for the wrong
information.

> SLF4J is written for multiple implementations. It has interfaces that
> allow this.
Yes but the glue classes which implements the interfaces ignore in
some cases the information you put into it. Of course I could write my
own implementation to fix it, but I think this isn't the idea of an
interface.

>
> Logback and SLF4J are more mature than Log4J and commons-logging IMO.

May be, I didn't find any information which shows this. There exist
good arguments why commons-logging in servlet container are not so
good as slf4j, but that's all I know. So I don't see a technical
problem with log4j at the moment.
Anyway it's not my decision.

Niels

Mike

unread,
Aug 26, 2010, 12:33:39 PM8/26/10
to play-framework
I would prefer a migration to Logback as well, as Logback is actually
intended to be the successor to log4j. Logback was designed by
log4j's founder, Ceki Gülcü.

At the very least, I feel playframework should include slf4j, so
people can drop in their choice of logging implementations.

Here's a quick visual on slf4j: http://www.slf4j.org/images/bindings.png.
And both log4j and Logback bindings are available.

On Aug 26, 6:51 am, GrailsDeveloper <opensourc...@googlemail.com>
wrote:

wyz

unread,
Aug 26, 2010, 8:34:58 PM8/26/10
to play-framework
AFAIK, slf4j is included in play's libraries and you can use its API
for logging. The only limitation is you cannot choose any other
implementation but log4j (i.e. you cannot use logback instead).

GrailsDeveloper

unread,
Sep 2, 2010, 1:36:39 PM9/2/10
to play-framework
I had a look to the slfj4j-api. There is one function I'm missed:
public void log(String callerFQCN, Priority level, Object message,
Throwable t). Without a possibility to define the callerFQCN, you
can't implement the Logger class correctly. Has anyone information how
to solve this?
Niels

On 27 Aug., 02:34, wyz <wangyiz...@gmail.com> wrote:
> AFAIK,slf4jis included in play's libraries and you can use its API
> for logging. The only limitation is you cannot choose any other
> implementation but log4j (i.e. you cannot use logback instead).
>
> On Aug 27, 12:33 am, Mike <mimbo...@gmail.com> wrote:
>
> > I would prefer a migration to Logback as well, as Logback is actually
> > intended to be the successor to log4j.  Logback was designed by
> > log4j's founder, Ceki Gülcü.
>
> > At the very least, I feel playframework should includeslf4j, so
> > people can drop in their choice of logging implementations.
>
> > Here's a quick visual onslf4j:  http://www.slf4j.org/images/bindings.png.
> > And both log4j and Logback bindings are available.
>
> > On Aug 26, 6:51 am, GrailsDeveloper <opensourc...@googlemail.com>
> > wrote:
>
> > > Hi
>
> > > On 26 Aug., 14:12, Mathias Bogaert <mathias.boga...@gmail.com> wrote:
>
> > > > Err. Parts of Logback that are not 'free'?? I can't find anything like
> > > > that. Readhttp://logback.qos.ch/license.html
>
> > > You are right, currently all parts are opensource. Sorry for the wrong
> > > information.
>
> > > >SLF4Jis written for multiple implementations. It has interfaces that
> > > > allow this.
>
> > > Yes but the glue classes which implements the interfaces ignore in
> > > some cases the information you put into it. Of course I could write my
> > > own implementation to fix it, but I think this isn't the idea of an
> > > interface.
>
> > > > Logback andSLF4Jare more mature than Log4J and commons-logging IMO.
>
> > > May be,  I didn't find any information which shows this. There exist
> > > good arguments why commons-logging in servlet container are not so
> > > good asslf4j, but that's all I know. So I don't see a technical
Reply all
Reply to author
Forward
0 new messages