struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <>
Subject Re: Less boilerplate in code
Date Thu, 15 May 2014 10:15:58 GMT
2014-05-15 3:40 GMT+02:00 Chris Pratt <>:
> Then you still have to use code like:
> if(LOG.isDebugEnabled()) {
>   LOG.debug("Action name is [#0]",action.getName());
> }
> Any time that the value isn't in an available primitive.  With Onyx you
> could just write:
> LOG.debug("Action name is {}",action);
> Which is much more readable and just as performant.

That's why I want to improve the implementations of XWork's Logger -
to get exactly the same gain

> Anyone who has an application with SLF4j, plus Log4j and other logging
> engines doesn't understand SLF4j.
> SLF4j provides an API for library developers to use (kind of in the old
> commons logging vein), where the back end decision can be given to the user
> of the library, but that's only the top level of SLF4j.

The same we have already in XWork logging layer, you're using one
Logger API but it depends on user which implementation to use (SLF4j,
Log4j, jul) just by dropping in given lib (or using if it's already

User can also implement its own version without too much hassle.

> As I said, SLF4j provides an API, but it also provides conduits to funnel
> just about any logging information through a SINGLE logging engine, be that
> Log4j, java.util.logging, SysOut, Logback or whatever you would like.  If
> you are using old libraries that haven't adopted SLF4j yet, and are using
> Log4j, commons logging or java.util.logging, you can add shims that will
> route all the information that was originally intended for that logging
> engine (i.e. java.util.logging or commons logging) through SLF4j, to the
> chosen logging engine (e.g. Log4j).  And, all you have to do to install
> most shims is drop the jar file in the libs directory.  That way you have
> one engine to configure, but you get control over all the logging
> information from all the libraries in your system.

The problem here is we're going to introduce a new required dependency
(SLF4j API) and this can be unacceptable for some companies (don't ask
me why, I know it's real). Another thing I just want to use what user
already is using and not tell him "add this jar, that jar and
configure it via xml" - overcomplicated.

Right now Struts will use what is already available on classpath -
Log4j, SLF4j, JDK logger - in that order. If user needs to use
specific implementation he can simple add
and done

> Weather or not you decide to go with my Onyx layer, I would strongly
> suggest moving to SLF4j.

Still not convinced, too often I saw projects that switched to SLF4j
just because (Hibernate) and now there are conflicts with different
version of SLF4j required per each product (ie. JBoss and Hibernate)

I'd rather adopt your Onyx lib to get power of extended logging capabilities.

+ 48 606 323 122

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message