Access log Bytes Written when compression is enabled

David Cleary <[email protected]> Tue, 24 Feb 2026 13:43:45 +0000
Newsgroups gmane.comp.jakarta.tomcat.user
Message-ID <CH8PR13MB7339B9BCF08564B90F0779F4DD74A@CH8PR13MB7339.namprd13.prod.outlook.com>
A customer is asking why the number of bytes written can appear as - in the access log when compression is enabled. They use this value in one of their monitoring tools.

AI tells me this:

When compression is enabled:

  1.  Compressed data is buffered in the compression filter layer
  2.  getBytesWritten(false) returns the count of bytes that have already been written to the socket
  3.  Any compressed data still residing in the buffer is not included because the buffer was never flushed
  4.  This can result in zero or an inaccurate byte count being logged

Is there any way to ensure this value gets logged when compression is enabled?

Thanks
Dave