On Thu, Aug 3, 2017 at 7:16 PM, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Martin,
>
> On 8/3/17 5:47 AM, Martin Knoblauch wrote:
> > is there a way to compress the localhost_access_log.#####.txt file
> > automatically after rotation?
>
> Not really. The file is rotated *during* log events, and stalling to
> compress a log file is probably not a great solution.
>
>
 Hmm. Smart way would be to rotate the log, continue logging to the new
file and compress the old one "in the background". That way stalling would
not be an issue.

> Alternatively/preferably is there a way to put the access logging
> > under "log4j"?
>
> Also not really, but if you are willing to write code, you can do it.
> The AccessLogValve handles its own logging to a file, but if you were
> to subclass AccessLogValve and override the "open" method and assign a
> value to the AccessLogValve.writer member that writes to a log4j
> logger, then I think you could probably do this.
>

Writing my own class is clearly an option, but I wanted to first check the
already available  options.


> I believe that log4j will stall your access log during the
> compression, though, so you might want to think about whether or not
> you want to implement it this way.
>
>
Need to check how they are doing it. We use rolling with compression, but
not on a high volume log like the access log.


> What is your operating system? If it were me, I think I'd write a cron
> job to check the directory for uncompressed, rotated log files and
> compress them in a separate process.
>
>
Linux. Sure, we can deploy Cron to do the compression. It just adds another
external process to an already complex setup. But I guess nothing in life
is free :-)


> > I am on Tomcat 7.0.62 (no, do not tell me to update. I know. I want
> > to. But I am not allowed to. So, do not tell me. Please :-)
>
> You should upgrade :)
>

I told you not to tell me :-)

Thanks
Martin


-- 
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de
www: http://www.knobisoft.de

Reply via email to