tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Tomcat logging, request
Date Fri, 25 Oct 2013 22:56:10 GMT
Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> André,
> 
> On 10/25/13, 7:18 AM, André Warnier wrote:
>> For example, a utility such as logrotate, in the sysadmin world, is
>> like a gift of God. Most server-like programs allow logrotate to
>> rotate their logfiles, compress old ones, remove even older ones,
>> etc. to keep things running smoothly over time. It's a simple
>> thing, but it saves many hours that would otherwise have to be
>> dedicated to monitoring and reacting to such repetitive
>> occurrences.
>>
>> Tomcat, at this moment, does not really allow that.
> 
> It does, but it's not terribly obvious how to do it.
> 
> Here are some ways to do it:
> 
> 1. Modify catalina.sh to pipe | instead of redirect >
> 2. Use "catalina.sh start | chronolog" or whatever
> 3. Configure logrotate to copy-and-truncate
> 4. Set CATALINA_OUT=/dev/null before launching
> 5. Set up a named pipe and set CATALINA_OUT to it before launching
>    (Plus have another process drain that pipe)
> 
>> That is because there is no simple mechanism to tell Tomcat to 
>> relinquish control of its current logfiles for a moment, short of 
>> stopping Tomcat completely and restarting it (which interrupts the 
>> service, sometimes for a significant amount of time).
> 
> What happens in httpd if I write a module that writes to stdout
> instead of the proper httpd-provided logging mechanisms?

The module's stdout/stderr is redirected to the Apache error log.

> 
>> So my request is simple (at least to express) : can someone among
>> the Tomcat luminaries not imagine a mechanism by which Tomcat
>> would, on request from an external program or script, do something
>> like the Apache httpd does during a "soft reload" : wait for the
>> current requests to terminate, close all logfiles and re-open them
>> ? For example : there already exist a "shutdown port", and a bunch
>> of "Listeners". Could there not be a "logs rotate port" or a
>> "logrotate listener" ?
> 
> It seems like this could be done via the manager webapp.
> 
>> I am not underestimating the possible difficulty of the task, and 
>> probably tackling such an issue is ultimately less rewarding for a 
>> developer than implementing the latest in webapp or HTTP
>> technology.
>>
>> But many sysadmins worldwide would be grateful if this came to pass
>> and I am sure that it would do a great deal to increase the
>> popularity of Tomcat among them.
> 
> Honestly, the only time this is really a problem is when catalina.out
> is filling-up with junk, right? It's always awkward when that happens.
> 

Yes, but the point is : the sysadmins do not generally control the code of the webapps.
They are just told to run them. And there are a lot of webapps that write to stdout. 
That's precisely the case of the last OP who posted about this.  But not only /his/ 
problem, by any means.


> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.15 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
> 
> iQIcBAEBCAAGBQJSarrOAAoJEBzwKT+lPKRYvm0QAJUo2B+jCjZhRVttEgIHrTcU
> BfPwRChIfExcfxPN5dSHU+0036tkle+TT7IUgIqbqnB2xSVNaZ4gChCyA+n6O54V
> eAMQqgYxTDdCggJbd3MFAfdTvbApQWYjbRRn44iyHufEaxiLjTDohkzdjNTzErIf
> g6CwoEs9ZS+DaRFR6Q1vxBg+QlcJOaruFNaRtJ+td/8yHSFDu+0w/EkBug9woewi
> GxcjaqiS0yujRC935oIbeCWI2sPswQHSTYA5Y2NY5rXtU2BCqAho5LRh+G0I8w7j
> dv/KPXfxHQDRw8R1xrE1D9y94tpNM7aHr/+xiVYQ/jBg2AE+hxT8FNi7LyP4Wcpr
> 7TXEdxFJMaKTujELTpP6SdZKmf/ic8EKeGSUaOFmebrlsB7MYzS0XFp87oKQsz4V
> +TXrvEKgx86xSTbWfJ9zq8fWrsq0HbIXOTVyItEVF8LZ1o15JBydwTm17d0XaQip
> dy+hG7t9NZorjL3hbRe0AOBZx//+E0VtrBfglFnbrWIyVMyot0nxhN0AzSo+HEtf
> stqUXTzOeJWhYzq3863rhZDxfA/p39u3qpjQs+V8gr+wW32i2Ya8CwJRfuLC4oeG
> FzkV8cbmS0yfp5WK1PktfX/ILw2uZVwpnHSZwFxkJ2DOginD7LRDh7MeogH4HBux
> YA+NtGl65CkNimI8Mpj/
> =X+tw
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


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


Mime
View raw message