You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by david <si...@theworld.com> on 2003/05/21 02:00:53 UTC

Getting the right HTTP status in apache log

Hi All,

If I set a 404 response status in my servlet then tomcat will send it's 404 
page and the apache access log shows a status of 404.

If I set a 404 response status in my servlet and catch it using a 
<error-page> web.xml directive then I can send my own 404 page but apache 
access log shows a 200 status.

Is there any way I can send my own page AND have the status show up as 404 
in apache access logs?

Obviously tomcat does this but I can't seem to do it myself.

Using rh8, tomcat 4.1.18, mod_jk, apache2
Thanks.
David


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Getting the right HTTP status in apache log

Posted by Tim Funk <fu...@joedog.org>.
In your 404 page (as defined by web.xml) - you must set the return code there.

Why? Because I may get rid of some pages and use my error page as a way to 
detect those missing pages (read: smart logging) then either redirect to the 
"correct page" or present a different message (which may not really relect a 
404 error to the client).

-Tim

david wrote:
> 
> Hi All,
> 
> If I set a 404 response status in my servlet then tomcat will send it's 
> 404 page and the apache access log shows a status of 404.
> 
> If I set a 404 response status in my servlet and catch it using a 
> <error-page> web.xml directive then I can send my own 404 page but 
> apache access log shows a 200 status.
> 
> Is there any way I can send my own page AND have the status show up as 
> 404 in apache access logs?
> 
> Obviously tomcat does this but I can't seem to do it myself.
> 
> Using rh8, tomcat 4.1.18, mod_jk, apache2
> Thanks.
> David
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Getting the right HTTP status in apache log

Posted by david <si...@theworld.com>.
I noticed one of my machines worked correctly, setting the right status 
code in the apache access log.  The difference is that the working machine 
is running 4.1.24 while all the others are running 4.1.18

I looked through the change log but didn't see a specific bug fix for that.


At 08:00 PM 5/20/2003 -0400, david wrote:

>Hi All,
>
>If I set a 404 response status in my servlet then tomcat will send it's 
>404 page and the apache access log shows a status of 404.
>
>If I set a 404 response status in my servlet and catch it using a 
><error-page> web.xml directive then I can send my own 404 page but apache 
>access log shows a 200 status.
>
>Is there any way I can send my own page AND have the status show up as 404 
>in apache access logs?
>
>Obviously tomcat does this but I can't seem to do it myself.
>
>Using rh8, tomcat 4.1.18, mod_jk, apache2
>Thanks.
>David
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org