Discussion:
Tomcat Valve
Campbell, Lance
2018-08-24 15:52:04 UTC
Permalink
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?

Thanks,

Lance
Mark Thomas
2018-08-24 16:06:40 UTC
Permalink
Post by Campbell, Lance
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.
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-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Campbell, Lance
2018-08-24 16:36:13 UTC
Permalink
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.
Post by Campbell, Lance
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.
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-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-m
Mark Thomas
2018-08-24 16:43:30 UTC
Permalink
Post by Campbell, Lance
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
Post by Campbell, Lance
Post by Campbell, Lance
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.
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-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Jäkel, Guido
2018-08-27 07:36:06 UTC
Permalink
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-----
Sent: Friday, August 24, 2018 6:44 PM
Subject: Re: Tomcat Valve
Post by Campbell, Lance
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
Post by Campbell, Lance
Post by Campbell, Lance
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.
Post by Campbell, Lance
Post by Campbell, Lance
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.
Post by Campbell, Lance
Post by Campbell, Lance
Does anyone have any suggestions?
tail -n 9 ${CATALINA_BASE}/logs/localhost_access_log.yyyy-mm-dd.txt
Mark
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
Т���������������������������������������������������������������������ХF�V�7V'67&�&R�R���âW6W'2�V�7V'67&�&TF��6B�6�R��&pФf�"FF�F����6����G2�R�
Christopher Schultz
2018-08-27 23:21:03 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Lance,
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?
Sounds like an X-Y problem: http://xyproblem.info/

Maybe you can tell us what Y is in this case?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluEh18ACgkQHPApP6U8
pFhPARAAhNHyEiiZeyoGN9MJKqPLtg+xneyuylr2ogIppparE20u5QPfXHs8LIoY
KdHcEldIsfgALeMoSf1yQ+mmmzRrwfXTWYk8sl+6bSzWmiPDh7Kzfkk+NbKCmuIw
P0lYk/1OPhDYWXVrv0OtztjxLyy+q1IyzRUF6L9A/j6wWmpdDbmgvARUYr88vaij
xsuPNFsEv59760g5Ax3STN8Pz9SJNAAScJGUURY4Y1gx62fzhLTjjuQJk59458hW
ju2SeceMKZDOYTLQtANArGaoayaNxsQC0zp1exSsjRcahhZFP9f84h3O6W03VCFd
aySRZEKw7RtH1W1TZVMJ+PdiwEEo2A8+g9eJOZqWx8J6Py0v0GUPyXczZCh8Uc24
OMdqJ778dhp6UjDeeEMIhDzmaws6BMrbqX/ghkCA2Wu9c6KXOuq3rW2tMi7r7nTa
3JEuYMNUXRTpSyCJl6ldFzhXK2Ly5a1hY1kGKR+5MPekDFNw+Y9uulgd2yK5beSv
9WOjwDSd3UTk3dIY5LiNumQlDIZ76jBnZDBwpuuvaZ/egKQZ5hgysdYGBroxBFXL
mGl1eOu9exks6TuCqpe5UXyPsaWFq40qwe5mvi/ra8qFc4z43mkLyGzwOcbsTT71
jyB8Ezau3aUkrsuLlPq4MZtjYZ/OWoq39ceH5kgguDra+u99Lpg=
=+9NE
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Christopher Schultz
2018-08-28 03:13:41 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Lance,
Post by Christopher Schultz
Lance,
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?
Sounds like an X-Y problem: http://xyproblem.info/
Maybe you can tell us what Y is in this case?
Uhh... actually I meant "what is X, here?" ;)

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluEveUACgkQHPApP6U8
pFh5Og//djlqDz0WsiVlHg+Z6w6cGUiXAOd8FiQOMPPvgps9fl0rLU5bMteyRO4D
YKrU8zECfbvZxDnt1aVtxcqrKVaVvu/YyObIUG/6xQAN7pqEz3iJJ/7tWLhaGvHn
/fw+8oFHiO2rrodr9M8OFpeYklhqLkP1N0yxZVn9pfUQKcN0hWgOEwdHL2TWicZm
kx2MRs2hr2SRTs0dxmIYNVpy6ajRL8CDYY02rItCWGZZ3BLLNaePvRfkBn+BMfdm
W8XF1vArV8JvMkydvNk6Nq1U0uxRCf8eeDuT7DtJ8ls6j8FFIA34OuLmiXao+5Bl
E6YfKcpjJgxxlJqbuz3UTPiSSJ7HK/XkR1lZhz/GSJP5BhoCGFv8wiEwscH2b6pF
sbsT8gn1OqfVgHZPYMViqxXHxpLitbV1ZrtbmtY0QGyyGW8lUOWWTO/Jor1CTgKo
Jh+G1FOT4L5q0bE1WmloRxjwj+lg7beMwGjLKp9+Lu+yZRjvz+bJUJNacHr5ysG2
EQiCTKGHdaImtSs0vg0N8t13RmjgMhZljMxeX46bk4nZ+MsAX1SxnBN8kZdXVHKy
aVXIez73a3FhjLy0+fVZlObsHWPvHtvSpX3VN3Slnc0g5Lm6X2feeZLpnv6irs3y
Wos/zAFA5opTa4pBoqz6+q9A5Btx3EHJQAK9XqagqZbYWjJ/TLU=
=CJN/
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
logo
2018-08-28 07:05:33 UTC
Permalink
Nice one Christopher. Didn't know that yet. Will bookmark.
Post by Christopher Schultz
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Lance,
Post by Christopher Schultz
Lance,
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?
Sounds like an X-Y problem: http://xyproblem.info/
Maybe you can tell us what Y is in this case?
Uhh... actually I meant "what is X, here?" ;)
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluEveUACgkQHPApP6U8
pFh5Og//djlqDz0WsiVlHg+Z6w6cGUiXAOd8FiQOMPPvgps9fl0rLU5bMteyRO4D
YKrU8zECfbvZxDnt1aVtxcqrKVaVvu/YyObIUG/6xQAN7pqEz3iJJ/7tWLhaGvHn
/fw+8oFHiO2rrodr9M8OFpeYklhqLkP1N0yxZVn9pfUQKcN0hWgOEwdHL2TWicZm
kx2MRs2hr2SRTs0dxmIYNVpy6ajRL8CDYY02rItCWGZZ3BLLNaePvRfkBn+BMfdm
W8XF1vArV8JvMkydvNk6Nq1U0uxRCf8eeDuT7DtJ8ls6j8FFIA34OuLmiXao+5Bl
E6YfKcpjJgxxlJqbuz3UTPiSSJ7HK/XkR1lZhz/GSJP5BhoCGFv8wiEwscH2b6pF
sbsT8gn1OqfVgHZPYMViqxXHxpLitbV1ZrtbmtY0QGyyGW8lUOWWTO/Jor1CTgKo
Jh+G1FOT4L5q0bE1WmloRxjwj+lg7beMwGjLKp9+Lu+yZRjvz+bJUJNacHr5ysG2
EQiCTKGHdaImtSs0vg0N8t13RmjgMhZljMxeX46bk4nZ+MsAX1SxnBN8kZdXVHKy
aVXIez73a3FhjLy0+fVZlObsHWPvHtvSpX3VN3Slnc0g5Lm6X2feeZLpnv6irs3y
Wos/zAFA5opTa4pBoqz6+q9A5Btx3EHJQAK9XqagqZbYWjJ/TLU=
=CJN/
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org

Loading...