Quantcast

Logging in Jersey

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Logging in Jersey

Robert Naczinski-2
Hi,

knows anybody, how I configure logging in Jersey?

We use native Log4J in our projects.

Thanx,

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging in Jersey

Paul Sandoz
Administrator

On Dec 8, 2009, at 9:28 AM, Robert Naczinski wrote:

> 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.


> We use native Log4J in our projects.
>
> Thanx,
>
> Robert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging in Jersey

smarthi
Paul,

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

Suneel




----- Original Message ----
From: Paul Sandoz <[hidden email]>
To: [hidden email]
Sent: Tue, December 8, 2009 5:09:04 AM
Subject: Re: [Jersey] Logging in Jersey


On Dec 8, 2009, at 9:28 AM, Robert Naczinski wrote:

> 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.


> We use native Log4J in our projects.
>
> Thanx,
>
> Robert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


     

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging in Jersey

Paul Sandoz
Administrator

On Dec 8, 2009, at 3:49 PM, Suneel Marthi wrote:

> 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.

> Suneel
>
>
>
>
> ----- Original Message ----
> From: Paul Sandoz <[hidden email]>
> To: [hidden email]
> Sent: Tue, December 8, 2009 5:09:04 AM
> Subject: Re: [Jersey] Logging in Jersey
>
>
> On Dec 8, 2009, at 9:28 AM, Robert Naczinski wrote:
>
>> 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.
>
>
>> We use native Log4J in our projects.
>>
>> Thanx,
>>
>> Robert
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging in Jersey

smarthi
Yes, that answers my question. Thanks Paul.



----- Original Message ----
From: Paul Sandoz <[hidden email]>
To: [hidden email]
Sent: Tue, December 8, 2009 10:31:03 AM
Subject: Re: [Jersey] Logging in Jersey


On Dec 8, 2009, at 3:49 PM, Suneel Marthi wrote:

> 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.

> Suneel
>
>
>
>
> ----- Original Message ----
> From: Paul Sandoz <[hidden email]>
> To: [hidden email]
> Sent: Tue, December 8, 2009 5:09:04 AM
> Subject: Re: [Jersey] Logging in Jersey
>
>
> On Dec 8, 2009, at 9:28 AM, Robert Naczinski wrote:
>
>> 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.
>
>
>> We use native Log4J in our projects.
>>
>> Thanx,
>>
>> Robert
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


     

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging in Jersey

jgzornoza
In reply to this post by smarthi
Hello Suneel,

I found this explanation very helpful for my project:
http://mail-archives.apache.org/mod_mbox/incubator-shiro-user/200907.mbox/<[hidden email]>


Suneel Marthi escribio':

> Paul,
>
> I am trying to use slf4j binding with log4j.  Is that not gonna work with Jersey?
>
> Suneel
>
>
>
>
> ----- Original Message ----
> From: Paul Sandoz <[hidden email]>
> To: [hidden email]
> Sent: Tue, December 8, 2009 5:09:04 AM
> Subject: Re: [Jersey] Logging in Jersey
>
>
> On Dec 8, 2009, at 9:28 AM, Robert Naczinski wrote:
>
>  
>> 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.
>
>
>  
>> We use native Log4J in our projects.
>>
>> Thanx,
>>
>> Robert
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>    
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>      
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging in Jersey

Samuel Le Berrigaud-3
In reply to this post by Paul Sandoz
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

On Tue, Dec 8, 2009 at 9:09 PM, Paul Sandoz <[hidden email]> wrote:

>
> On Dec 8, 2009, at 9:28 AM, Robert Naczinski wrote:
>
>> 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.
>
>
>> We use native Log4J in our projects.
>>
>> Thanx,
>>
>> Robert
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging in Jersey

Craig McClanahan-2
On Tue, Dec 8, 2009 at 1:35 PM, Samuel Le Berrigaud
<[hidden email]> wrote:

> 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

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging in Jersey

emicklei
This post has NOT been accepted by the mailing list yet.
In reply to this post by Robert Naczinski-2
To shut if off

java.util.logging.Logger jersey = java.util.logging.Logger.getLogger("com.sun.jersey");
jersey.setLevel(java.util.logging.Level.OFF);
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging in Jersey

emicklei
In reply to this post by Robert Naczinski-2
To shut if off

java.util.logging.Logger jersey = java.util.logging.Logger.getLogger("com.sun.jersey");
jersey.setLevel(java.util.logging.Level.OFF);
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging in Jersey

Philippe Marschall
In reply to this post by Samuel Le Berrigaud-3
On 12/08/2009 10:35 PM, Samuel Le Berrigaud wrote:

> 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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging in Jersey

jyeary
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
____________________________ 

       
____________________________ 

"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 <[hidden email]> wrote:
On 12/08/2009 10:35 PM, Samuel Le Berrigaud wrote:
> 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


Loading...