Dear Lance

I don't know the motivation for your usecase. But note that the access log is 
written after handling the complete request (therefore its able to log the 
number of bytes send) and, because it's typical buffered, with a delay, too.

This means, that a request is listed there only in the case of a proper 
shutdown. If the Tomcat come down because of a JVM OOM or something like this, 
this might be inaccurate.

In addition, if you tell the Tomcat to shut down, one of the first steps is to 
block the "Connectors", i.e. the receivers for HTTP (and/or AJP). Request will 
be rejected then, but not logged anymore.  Then, further shutdown will happen, 
e.g. the shutdown of the Servlet Containere(s). This may take some notable time 
and during this, the JVM -- Maybe from another point of view called "the Tomcat 
Process" -- is still running.

Greetings

Guido

>-----Original Message-----
>From: Mark Thomas [mailto:ma...@apache.org]
>Sent: Friday, August 24, 2018 6:44 PM
>To: users@tomcat.apache.org
>Subject: Re: Tomcat Valve
>
>On 24/08/18 17:36, Campbell, Lance wrote:
>> I don't understand.  How does that help a valve running know that it is 
>> shutting down?  At that point it would be too late.
>
>The point is you don't need a valve to answer your question. Just look
>at the last 9 entries in the access log.
>
>Mark
>
>>
>> On 8/24/18, 11:06 AM, "Mark Thomas" <ma...@apache.org> wrote:
>>
>>     On 24/08/18 16:52, Campbell, Lance wrote:
>>     > Tomcat 9
>>     > Use Case 1:  I want to store the last N number of URLs sent to Tomcat 
>> 9 application.  Then if Tomcat shuts down I want
>to write out these last N number of URLs to the log file.
>>     >
>>     > Strategy:
>>     > I figured I would use a valve to keep track of the last N number of 
>> URLs.  However I don’t know how to tell when the
>valve is shutting down.
>>     >
>>     > Does anyone have any suggestions?
>>
>>     tail -n 9 ${CATALINA_BASE}/logs/localhost_access_log.yyyy-mm-dd.txt
>>
>>     Mark
>>
>>     ---------------------------------------------------------------------
>>     To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>     For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to