struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Pratt <thechrispr...@gmail.com>
Subject Re: Less boilerplate in code
Date Thu, 15 May 2014 01:40:17 GMT
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 {0.name}",action);

Which is much more readable and just as performant.

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.

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.

Weather or not you decide to go with my Onyx layer, I would strongly
suggest moving to SLF4j.
  (*Chris*)
On May 14, 2014 5:51 PM, "Lukasz Lenart" <lukaszlenart@apache.org> wrote:

> Hi,
>
> What do you think about that idea [1]?
>
> Basically instead of doing this:
>
> if (LOG.isDebugEnable()) {
>      LOG.debug("Action name is [#0]', actionName);
> }
>
> it will be possible to do this:
>
> LOG.debug("Action name is [#0]', actionName);
>
> with implementation in eg. JdkLogger like this:
>
> public void debug(String message, String... params) {
>     if(isDebugEnable()) {
>          // perform logging
>     }
> }
>
> wiht assumption that we always use version with params and don't use
> string concatenation
>
> [1] https://issues.apache.org/jira/browse/WW-4344
>
>
> Regards
> --
> Ɓukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message