You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Sean McFadden <se...@wingateweb.com> on 2000/05/25 18:57:25 UTC
Application Logging
I am deploying a web application on Tomcat 3.1 and things are working
rather nicely. I like the new release enhancements. However, I
discovered a small issue concerning application error logging: calls to
"ServletContext.log(String "my error message", Exception myException)"
seem to ignore any Throwable objects references. Unfortunately my code
is sprinkled with such calls.
After tinkering with the server.xml file to no avail, I decided to scan
the source code to see what was happening to my Exceptions. I discovered
that any Servlet calls to "log(....)" are hard-coded to a verbosity
level of "INFORMATION" and ignore all Throwable references passed in.
If anyone happens to be currently working on the Tomcat logging
mechanism, it would be nice to see those stack traces appear in the log.
It would be even better if the Tomcat configuration (code, XML, etc.)
would allow each individual context to define its own log file, with its
own verbosity level. Is anyone working on logging right now?
Thanks,
Sean M.
Re: Application Logging
Posted by Costin Manolache <co...@eng.sun.com>.
Hi Mark,
I have a lot of work those days, it will help a lot if you could send patches. I
really need help, everything have "high" priority and is important and urgent.
In this case - you can catch the Exception inside the servlet body if you don't
want to be interupted. I think the behavior is correct - if your servlet can't
write to the client an exception is generated, and you can choose what to do.
( at least that was the intention )
A problem with "Broken pipe" is that it's hard to know if a IOException is indeed a
BorkenPipe or something else.
I think it's important to report the real errors, but you should have a flag to
filter out the stack traces. It's not hard - but somebody has to do it :-(
Costin
Mark Brouwer wrote:
> Hi Costin,
>
> Costin Manolache wrote:
> >
> > > Nothing seems to have happened since I reported the bug, I think the main
> > > person working on the existing code (rather than the proposal for the next
> > > version, catalina) is Costin, but I'd imagine he's pretty snowed under with
> > > work.
> >
> > I don't have too much time, but if you send a patch I'll just check it in.
> >
> > I do want to spend some time with the logging system ( I want to add
> > an option to disable sending the stack traces to the browser - you don't
> > want a production system to give details about what's inside !) and
> > the full logging can be greatly simplified. If I find the time I'll also try
> > to
> >
>
> Can you also make those broken pipe exceptions disappear, for its common
> with HTTP clients loose their interest in responses. Every day I had
> many MBs of log in production, just because of this. I patched it for
> our production server in a few places but it should be done in a more
> decent way.
>
> BTW the servlet 2.2 spec is not clear about what the behaviour should be
> in such a case. Throw an IOException right away or finish the response
> first. I pointed this out to Servlet spec lead Danny Coward and I felt
> so free to cut/copy/paste his response in this mail.
>
> --
>
> Thanks for bringing this up Mark. We don't specify any behavior in this
> case.
> I will add it to the list of things to clarify for 2.3.
>
> Thanks again for your input on this.
>
> - Danny
>
> > Hi,
> >
> > I just ran into something I couldn't resolve by reading the Servlet 2.2
> > specs, meaning it is not in there or I just overlooked it. Therefore I
> > ask for clarification that could be part of the upcoming Servlet 2.3
> > specification, if it is not already in there. The case is:
> >
> > What should a container do in case the client leaves before the response
> > has been finished. Should a ServletException be thrown by the container
> > or should it ignore this and continue processing of the Servlet.
> >
> > I encountered different behaviour with several Servlet containers. What
> > I can recall from memory is that JSWDK continued processing the servlet
> > and Tomcat 3.1 immediately throws a ServletException (Broken pipe).
> >
> > This can be an issue with regard to the state your is servlet left in.
> >
> > For some circumstances I would like to now if the client has left, in
> > some other circumstances I just would like to see the processing of the
> > servlet finish. I think a property for the behaviour would be over the
> > top, therefore I leave it up to you :-)
> >
> > Regards,
> > --
> > Mark Brouwer
> > Virgil B.V.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
Re: Application Logging
Posted by Mark Brouwer <ma...@virgil.nl>.
Hi Costin,
Costin Manolache wrote:
>
> > Nothing seems to have happened since I reported the bug, I think the main
> > person working on the existing code (rather than the proposal for the next
> > version, catalina) is Costin, but I'd imagine he's pretty snowed under with
> > work.
>
> I don't have too much time, but if you send a patch I'll just check it in.
>
> I do want to spend some time with the logging system ( I want to add
> an option to disable sending the stack traces to the browser - you don't
> want a production system to give details about what's inside !) and
> the full logging can be greatly simplified. If I find the time I'll also try
> to
>
Can you also make those broken pipe exceptions disappear, for its common
with HTTP clients loose their interest in responses. Every day I had
many MBs of log in production, just because of this. I patched it for
our production server in a few places but it should be done in a more
decent way.
BTW the servlet 2.2 spec is not clear about what the behaviour should be
in such a case. Throw an IOException right away or finish the response
first. I pointed this out to Servlet spec lead Danny Coward and I felt
so free to cut/copy/paste his response in this mail.
--
Thanks for bringing this up Mark. We don't specify any behavior in this
case.
I will add it to the list of things to clarify for 2.3.
Thanks again for your input on this.
- Danny
> Hi,
>
> I just ran into something I couldn't resolve by reading the Servlet 2.2
> specs, meaning it is not in there or I just overlooked it. Therefore I
> ask for clarification that could be part of the upcoming Servlet 2.3
> specification, if it is not already in there. The case is:
>
> What should a container do in case the client leaves before the response
> has been finished. Should a ServletException be thrown by the container
> or should it ignore this and continue processing of the Servlet.
>
> I encountered different behaviour with several Servlet containers. What
> I can recall from memory is that JSWDK continued processing the servlet
> and Tomcat 3.1 immediately throws a ServletException (Broken pipe).
>
> This can be an issue with regard to the state your is servlet left in.
>
> For some circumstances I would like to now if the client has left, in
> some other circumstances I just would like to see the processing of the
> servlet finish. I think a property for the behaviour would be over the
> top, therefore I leave it up to you :-)
>
> Regards,
> --
> Mark Brouwer
> Virgil B.V.
Re: Application Logging
Posted by Costin Manolache <co...@eng.sun.com>.
> Nothing seems to have happened since I reported the bug, I think the main
> person working on the existing code (rather than the proposal for the next
> version, catalina) is Costin, but I'd imagine he's pretty snowed under with
> work.
I don't have too much time, but if you send a patch I'll just check it in.
I do want to spend some time with the logging system ( I want to add
an option to disable sending the stack traces to the browser - you don't
want a production system to give details about what's inside !) and
the full logging can be greatly simplified. If I find the time I'll also try
to
implement Sam's idea - it would be useful not only for tomcat.
The idea was to have multiple log methods, with multiple parameter types,
log( int level, String comp, String msg, String param, STring param20), etc.
This saves concatentations and allow multiple message formats.
Costin
Re: Application Logging
Posted by Geoff Soutter <ge...@whitewolf.com.au>.
"Sean McFadden" <se...@wingateweb.com> wrote:
> After tinkering with the server.xml file to no avail, I decided to scan
> the source code to see what was happening to my Exceptions. I discovered
> that any Servlet calls to "log(....)" are hard-coded to a verbosity
> level of "INFORMATION" and ignore all Throwable references passed in.
yeah, I discovered the same things a few days ago. it also ignores the
rootCause exception if you throw ServletExceptions with nested exceptions
inside them.
Unfortunately the bug tracking system was pulled for security reasons a few
weeks back, which makes things like this a bit hard.
> If anyone happens to be currently working on the Tomcat logging
> mechanism, it would be nice to see those stack traces appear in the log.
> It would be even better if the Tomcat configuration (code, XML, etc.)
> would allow each individual context to define its own log file, with its
> own verbosity level. Is anyone working on logging right now?
Nothing seems to have happened since I reported the bug, I think the main
person working on the existing code (rather than the proposal for the next
version, catalina) is Costin, but I'd imagine he's pretty snowed under with
work.
I've been meaning to make up a patch to fix this but the code quality in
some areas is so poor it's difficult to feel confident in fixing it
properly... not to mention I'm busy!
Note, I'm not one of the commiters, just interested in this area...
cheers
Geoff