Discussion:
Logging in Jersey
Robert Naczinski
2009-12-08 08:28:45 UTC
Permalink
Hi,

knows anybody, how I configure logging in Jersey?

We use native Log4J in our projects.

Thanx,

Robert
Paul Sandoz
2009-12-08 10:09:04 UTC
Permalink
Post by Robert Naczinski
Hi,
knows anybody, how I configure logging in Jersey?
Jersey currently uses JDK logging, so any configuration needs to
utilize that. The current reason for not switching is to avoid adding
further dependencies. If there are significant advantages we could
switch e.g. to slf4j.

BTW we need to review the exception throwing and logging in Jersey.
Currently it's a bit chaotic. For example, we should expose a well-
defined set of loggers that are publicly available for configuration.

Paul.
Post by Robert Naczinski
We use native Log4J in our projects.
Thanx,
Robert
---------------------------------------------------------------------
Suneel Marthi
2009-12-08 14:49:43 UTC
Permalink
Paul,

I am trying to use slf4j binding with log4j. Is that not gonna work with Jersey?

Suneel




----- Original Message ----
From: Paul Sandoz <Paul.Sandoz-UdXhSnd/***@public.gmane.org>
To: users-fknO4uJe+***@public.gmane.org
Sent: Tue, December 8, 2009 5:09:04 AM
Subject: Re: [Jersey] Logging in Jersey
Post by Robert Naczinski
Hi,
knows anybody, how I configure logging in Jersey?
Jersey currently uses JDK logging, so any configuration needs to utilize that. The current reason for not switching is to avoid adding further dependencies. If there are significant advantages we could switch e.g. to slf4j.

BTW we need to review the exception throwing and logging in Jersey. Currently it's a bit chaotic. For example, we should expose a well-defined set of loggers that are publicly available for configuration.

Paul.
Post by Robert Naczinski
We use native Log4J in our projects.
Thanx,
Robert
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe-fknO4uJe+***@public.gmane.org
For additional commands, e-mail: users-help-fknO4uJe+***@public.gmane.org
Paul Sandoz
2009-12-08 15:31:03 UTC
Permalink
Post by Suneel Marthi
Paul,
I am trying to use slf4j binding with log4j. Is that not gonna work with Jersey?
There is no restriction in terms of the logging solution that your
application uses. But since Jersey uses JDK logging you need to
utilize JDK logging configuration or some suitable bridge to it to
control the logging output from the Jersey runtime. Does that answer
your question?

Paul.
Post by Suneel Marthi
Suneel
----- Original Message ----
Sent: Tue, December 8, 2009 5:09:04 AM
Subject: Re: [Jersey] Logging in Jersey
Post by Robert Naczinski
Hi,
knows anybody, how I configure logging in Jersey?
Jersey currently uses JDK logging, so any configuration needs to
utilize that. The current reason for not switching is to avoid
adding further dependencies. If there are significant advantages we
could switch e.g. to slf4j.
BTW we need to review the exception throwing and logging in Jersey.
Currently it's a bit chaotic. For example, we should expose a well-
defined set of loggers that are publicly available for configuration.
Paul.
Post by Robert Naczinski
We use native Log4J in our projects.
Thanx,
Robert
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
Suneel Marthi
2009-12-08 15:33:23 UTC
Permalink
Yes, that answers my question. Thanks Paul.



----- Original Message ----
From: Paul Sandoz <Paul.Sandoz-UdXhSnd/***@public.gmane.org>
To: users-fknO4uJe+***@public.gmane.org
Sent: Tue, December 8, 2009 10:31:03 AM
Subject: Re: [Jersey] Logging in Jersey
Post by Suneel Marthi
Paul,
I am trying to use slf4j binding with log4j. Is that not gonna work with Jersey?
There is no restriction in terms of the logging solution that your application uses. But since Jersey uses JDK logging you need to utilize JDK logging configuration or some suitable bridge to it to control the logging output from the Jersey runtime. Does that answer your question?

Paul.
Post by Suneel Marthi
Suneel
----- Original Message ----
Sent: Tue, December 8, 2009 5:09:04 AM
Subject: Re: [Jersey] Logging in Jersey
Post by Robert Naczinski
Hi,
knows anybody, how I configure logging in Jersey?
Jersey currently uses JDK logging, so any configuration needs to utilize that. The current reason for not switching is to avoid adding further dependencies. If there are significant advantages we could switch e.g. to slf4j.
BTW we need to review the exception throwing and logging in Jersey. Currently it's a bit chaotic. For example, we should expose a well-defined set of loggers that are publicly available for configuration.
Paul.
Post by Robert Naczinski
We use native Log4J in our projects.
Thanx,
Robert
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe-fknO4uJe+***@public.gmane.org
For additional commands, e-mail: users-help-fknO4uJe+***@public.gmane.org
Jose Javier García Zornoza
2009-12-08 16:21:09 UTC
Permalink
Hello Suneel,
Post by Suneel Marthi
Paul,
I am trying to use slf4j binding with log4j. Is that not gonna work with Jersey?
Suneel
----- Original Message ----
Sent: Tue, December 8, 2009 5:09:04 AM
Subject: Re: [Jersey] Logging in Jersey
Post by Robert Naczinski
Hi,
knows anybody, how I configure logging in Jersey?
Jersey currently uses JDK logging, so any configuration needs to utilize that. The current reason for not switching is to avoid adding further dependencies. If there are significant advantages we could switch e.g. to slf4j.
BTW we need to review the exception throwing and logging in Jersey. Currently it's a bit chaotic. For example, we should expose a well-defined set of loggers that are publicly available for configuration.
Paul.
Post by Robert Naczinski
We use native Log4J in our projects.
Thanx,
Robert
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
Samuel Le Berrigaud
2009-12-08 21:35:56 UTC
Permalink
Hi Paul,

I think moving to slf4j would be great. One of the big issue with the
JDK Logging is that it doesn't allow per webapp configuration, it a
JVM wide configuration which means that configuring for one webapp
could affect the logging of other applications running in the same
JVM.

This is a major drawback when you build an webapp and don't
necessarily control the environment in which it will get deployed (our
customers can chose how they deploy it). All we want/need is to enable
our customers to configure the logging of our application without
affecting other application or even the app server. For this reason I
would strongly suggest moving away from JDK logging.

slf4j is definitely the best choice for logging nowadays and those who
want to ultimately use JDK logging still can with a minimal impact on
performance, permgen etc.

What do you think?

SaM
Post by Suneel Marthi
Post by Robert Naczinski
Hi,
knows anybody, how I configure logging in Jersey?
Jersey currently uses JDK logging, so any configuration needs to utilize
that. The current reason for not switching is to avoid adding further
dependencies. If there are significant advantages we could switch e.g. to
slf4j.
BTW we need to review the exception throwing and logging in Jersey.
Currently it's a bit chaotic. For example, we should expose a well-defined
set of loggers that are publicly available for configuration.
Paul.
Post by Robert Naczinski
We use native Log4J in our projects.
Thanx,
Robert
---------------------------------------------------------------------
---------------------------------------------------------------------
Craig McClanahan
2009-12-08 22:24:45 UTC
Permalink
On Tue, Dec 8, 2009 at 1:35 PM, Samuel Le Berrigaud
Post by Samuel Le Berrigaud
I think moving to slf4j would be great. One of the big issue with the
JDK Logging is that it doesn't allow per webapp configuration, it a
JVM wide configuration which means that configuring for one webapp
could affect the logging of other applications running in the same
JVM.
While this is true for the "out of the box" JDK LogManager, several
servers have provided extended LogManager implementations that support
per-webapp configuration. For example, Tomcat and JBoss both use JULI
to provide this -- see
<http://www.crazysquirrel.com/computing/java/logging.jspx> for more
info.

Craig
Philippe Marschall
2012-01-27 17:13:46 UTC
Permalink
Post by Samuel Le Berrigaud
Hi Paul,
I think moving to slf4j would be great. One of the big issue with the
JDK Logging is that it doesn't allow per webapp configuration, it a
JVM wide configuration which means that configuring for one webapp
could affect the logging of other applications running in the same
JVM.
This is a major drawback when you build an webapp and don't
necessarily control the environment in which it will get deployed (our
customers can chose how they deploy it). All we want/need is to enable
our customers to configure the logging of our application without
affecting other application or even the app server. For this reason I
would strongly suggest moving away from JDK logging.
slf4j is definitely the best choice for logging nowadays and those who
want to ultimately use JDK logging still can with a minimal impact on
performance, permgen etc.
What do you think?
I second this. All frameworks and libraries that use a logging
implementation (eg. Log4j, jul or logback) are a pain to integrate. Sure
there are hacks to make it work, but they are painful and just that,
hacks. That's why logging bridges were invented ten years ago. These
days slf4j is the logging bridge to use.

Cheers
Philippe
John Yeary
2012-01-27 18:45:40 UTC
Permalink
Hello All,

I am in favor of using a bridge to make it easier to configure on a per
project basis, but I will leave it open as to the selection. slf4j is very
popular, but may not be the best fit. I think that it is more important to
figure out the requirements instead of the solution first.

John
____________________________

John Yeary
____________________________

<http://javaevangelist.blogspot.com/> <https://twitter.com/jyeary>
<http://www.youtube.com/johnyeary>
<http://www.linkedin.com/in/jyeary>
<https://plus.google.com/112146428878473069965>
<http://www.facebook.com/jyeary>
<http://feeds.feedburner.com/JavaEvangelistJohnYearysBlog>
<http://netbeans.org/people/84414-jyeary>
____________________________

"Far better it is to dare mighty things, to win glorious triumphs, even
though checkered by failure, than to take rank with those poor spirits who
neither enjoy much nor suffer much, because they live in the gray twilight
that knows not victory nor defeat."
-- Theodore Roosevelt



On Fri, Jan 27, 2012 at 12:13 PM, Philippe Marschall <
Post by Philippe Marschall
Post by Samuel Le Berrigaud
Hi Paul,
I think moving to slf4j would be great. One of the big issue with the
JDK Logging is that it doesn't allow per webapp configuration, it a
JVM wide configuration which means that configuring for one webapp
could affect the logging of other applications running in the same
JVM.
This is a major drawback when you build an webapp and don't
necessarily control the environment in which it will get deployed (our
customers can chose how they deploy it). All we want/need is to enable
our customers to configure the logging of our application without
affecting other application or even the app server. For this reason I
would strongly suggest moving away from JDK logging.
slf4j is definitely the best choice for logging nowadays and those who
want to ultimately use JDK logging still can with a minimal impact on
performance, permgen etc.
What do you think?
I second this. All frameworks and libraries that use a logging
implementation (eg. Log4j, jul or logback) are a pain to integrate. Sure
there are hacks to make it work, but they are painful and just that,
hacks. That's why logging bridges were invented ten years ago. These
days slf4j is the logging bridge to use.
Cheers
Philippe
emicklei
2012-01-27 14:46:16 UTC
Permalink
To shut if off

java.util.logging.Logger jersey =
java.util.logging.Logger.getLogger("com.sun.jersey");
jersey.setLevel(java.util.logging.Level.OFF);

--
View this message in context: http://jersey.576304.n2.nabble.com/Logging-in-Jersey-tp4131156p7229909.html
Sent from the Jersey mailing list archive at Nabble.com.
Loading...