You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Sam Berlin <sb...@gmail.com> on 2008/03/31 21:09:37 UTC

Logging in core / core-nio

Hi Folks,

There's been a number of times that we've been looking to debug things
within httpcore & httpcore-nio, but have to resort to recompiling
and/or using a debugger with breakpoints, due to no logging within the
package.  I can understand the desire to reduce dependencies, but I
humbly disagree with the conclusion.  In my opinion, logging in
httpcore & httpcore-nio is very much useful & necessary.

Is this issue firmly closed, or could logging somehow be added back
into core & core-nio?

Thanks,
 Sam

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Logging in core / core-nio

Posted by Sam Berlin <sb...@gmail.com>.
The decorator's probably good enough for now.  I'll come back
complainin' when it isn't good enough. :)

Sam

On 3/31/08, Oleg Kalnichevski <ol...@apache.org> wrote:
>
> On Mon, 2008-03-31 at 15:09 -0400, Sam Berlin wrote:
> > Hi Folks,
> >
> > There's been a number of times that we've been looking to debug things
> > within httpcore & httpcore-nio, but have to resort to recompiling
> > and/or using a debugger with breakpoints, due to no logging within the
> > package.  I can understand the desire to reduce dependencies, but I
> > humbly disagree with the conclusion.  In my opinion, logging in
> > httpcore & httpcore-nio is very much useful & necessary.
> >
> > Is this issue firmly closed, or could logging somehow be added back
> > into core & core-nio?
> >
> > Thanks,
> >  Sam
> >
>
> Hi Sam,
>
> I generally tend to think it is much, much cleaner and proper to inject
> logging capabilities using the Decorator pattern and still see no need
> to impose a choice of a particular logging toolkit onto all users of
> HttpCore.
>
> You can find decorators for the NIO interfaces in the contrib package:
>
> http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/
>
> Would that solve the problem for you?
>
> Oleg
>
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > For additional commands, e-mail: dev-help@hc.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Logging in core / core-nio

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2008-03-31 at 15:09 -0400, Sam Berlin wrote:
> Hi Folks,
> 
> There's been a number of times that we've been looking to debug things
> within httpcore & httpcore-nio, but have to resort to recompiling
> and/or using a debugger with breakpoints, due to no logging within the
> package.  I can understand the desire to reduce dependencies, but I
> humbly disagree with the conclusion.  In my opinion, logging in
> httpcore & httpcore-nio is very much useful & necessary.
> 
> Is this issue firmly closed, or could logging somehow be added back
> into core & core-nio?
> 
> Thanks,
>  Sam
> 

Hi Sam,

I generally tend to think it is much, much cleaner and proper to inject
logging capabilities using the Decorator pattern and still see no need
to impose a choice of a particular logging toolkit onto all users of
HttpCore. 

You can find decorators for the NIO interfaces in the contrib package:

http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/

Would that solve the problem for you?

Oleg


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Logging in core / core-nio

Posted by Ortwin Glück <od...@odi.ch>.
Tatu Saloranta wrote:
> To me, logging statements in production are generally
> to be used for reporting unusual things happening

That totally depends on the application. We run a lot of server code that 
reflects not directly in any user interface. The log is the ONLY way to know 
what has been going on (especially in an error condition, when the transaction 
is rolled back and you thus have no change on the DB). Hooking the debugger into 
a production application server is not feasible most of the time, as setting a 
breakpoint is not selective to a specific thread and would block ANY thread that 
accidentially hits the break point. Even worse in non-blocking NIO code: a 
breakpoint will inadvertly affect hundreds of sessions.
To find bugs in server side logic, for me the log is the most important thing.

Ortwin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Logging in core / core-nio

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2008-04-01 at 09:44 -0700, Tatu Saloranta wrote:
> --- Sam Berlin <sb...@gmail.com> wrote:
> 
> > Hi Folks,
> > 
> > There's been a number of times that we've been
> > looking to debug things
> > within httpcore & httpcore-nio, but have to resort
> > to recompiling
> > and/or using a debugger with breakpoints, due to no
> > logging within the
> > package.  I can understand the desire to reduce
> 
> I somewhat disagree in that using a debugger with
> breakpoints is considered a work-around: especially if
> contrasted to speculative insertion of logging 
> statements that mess up otherwise clean code and only
> provides useful information for narrow cases of
> debugging.
> To me, logging statements in production are generally
> to be used for reporting unusual things happening, and
> not for indicating normal control flow. If you want to
> follow the control flow, stepping through the code in
> debugger is the simplest way to go about it.
> I do understand that debugging a multi-thread thing
> obviously can be tricky, but same problems often apply
> to logging, which flattens textual messages into
> combined streams (except for the particular problem of
> things timing out).
> 
> This is of course an area where styles and taste
> differ a lot between developers. But I think perhaps
> it'd be better to think hard about good ways to solve
> the actual problem (how to debug problems that
> commonly occur) instead of focusing on one particular
> approach developers tend to take, regardless of
> whether it is an optimal way. For me, a better
> alternative often is to allow adding listeners for
> events that are of interest during debugging (I think
> there already are a few types one can attach so maybe
> that path is already available and/or exhausted?).
> This allows for developers to plug-in particular
> diagnostics extensions they want, including simpler
> loggers.

I am of the same opinion.


> This is also one of few areas where aspect-oriented
> stuff makes a lot of sense.
> 

I agree. I think the byte code enhancement is probably the cleanest way
to add _debug_ logging for low level libraries such as HttpCore.

Cheers

Oleg


> Just my 2 cents,
> 
> -+ Tatu +-
> 
> 
> 
>       ____________________________________________________________________________________
> You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
> http://tc.deals.yahoo.com/tc/blockbuster/text5.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Logging in core / core-nio

Posted by Tatu Saloranta <co...@yahoo.com>.
--- Sam Berlin <sb...@gmail.com> wrote:

> Hi Folks,
> 
> There's been a number of times that we've been
> looking to debug things
> within httpcore & httpcore-nio, but have to resort
> to recompiling
> and/or using a debugger with breakpoints, due to no
> logging within the
> package.  I can understand the desire to reduce

I somewhat disagree in that using a debugger with
breakpoints is considered a work-around: especially if
contrasted to speculative insertion of logging 
statements that mess up otherwise clean code and only
provides useful information for narrow cases of
debugging.
To me, logging statements in production are generally
to be used for reporting unusual things happening, and
not for indicating normal control flow. If you want to
follow the control flow, stepping through the code in
debugger is the simplest way to go about it.
I do understand that debugging a multi-thread thing
obviously can be tricky, but same problems often apply
to logging, which flattens textual messages into
combined streams (except for the particular problem of
things timing out).

This is of course an area where styles and taste
differ a lot between developers. But I think perhaps
it'd be better to think hard about good ways to solve
the actual problem (how to debug problems that
commonly occur) instead of focusing on one particular
approach developers tend to take, regardless of
whether it is an optimal way. For me, a better
alternative often is to allow adding listeners for
events that are of interest during debugging (I think
there already are a few types one can attach so maybe
that path is already available and/or exhausted?).
This allows for developers to plug-in particular
diagnostics extensions they want, including simpler
loggers.
This is also one of few areas where aspect-oriented
stuff makes a lot of sense.

Just my 2 cents,

-+ Tatu +-



      ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org