You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aryeh Friedman <ar...@gmail.com> on 2024/01/29 20:28:05 UTC

Rotating/archiving catalina.out

We need to shrink the size of catalina.out but looking at the logging
documentation I do not see any way to do this with the standard
logging.properties (or else where).   Due to the nature of the
production site we never bring it completely down unless we must (life
critical 24/7/365)

Specifically we have a fair number of System.out.println's with
debugging information to it and we dumb stack traces into it also.
And without stopping and restarting tomcat we want to make it so there
is periodic rotation of catalina.out to some other file?   (note stack
traces do go to the dated one but not the System.out.println's)

-- 
Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org

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


Re: Rotating/archiving catalina.out

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Aryeh,

On 1/29/24 15:28, Aryeh Friedman wrote:
> We need to shrink the size of catalina.out but looking at the logging
> documentation I do not see any way to do this with the standard
> logging.properties (or else where).   Due to the nature of the
> production site we never bring it completely down unless we must (life
> critical 24/7/365)
> 
> Specifically we have a fair number of System.out.println's with
> debugging information to it and we dumb stack traces into it also.
> And without stopping and restarting tomcat we want to make it so there
> is periodic rotation of catalina.out to some other file?   (note stack
> traces do go to the dated one but not the System.out.println's)

What OS is this? How do you launch Tomcat?

When launched via command-line scripts, catalina.out is created using 
stdout redirection in the shell. There is not really any opportunity for 
rotation, there.

Depending upon your environment, you may have some options.

The best option is to stop using stdout.

-chris

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


Re: Rotating/archiving catalina.out

Posted by Tim Funk <fu...@apache.org>.
One option (hacky workaround) is to try using "swallowOutput"
which may mitigate the worst of your issue. (Beyond a rewrite with
a logging framework)

https://tomcat.apache.org/tomcat-9.0-doc/config/context.html

-Tim

On Mon, Jan 29, 2024 at 3:28 PM Aryeh Friedman <ar...@gmail.com>
wrote:

> We need to shrink the size of catalina.out but looking at the logging
> documentation I do not see any way to do this with the standard
> logging.properties (or else where).   Due to the nature of the
> production site we never bring it completely down unless we must (life
> critical 24/7/365)
>
> Specifically we have a fair number of System.out.println's with
> debugging information to it and we dumb stack traces into it also.
> And without stopping and restarting tomcat we want to make it so there
> is periodic rotation of catalina.out to some other file?   (note stack
> traces do go to the dated one but not the System.out.println's)
>
>

Re: Rotating/archiving catalina.out

Posted by Michael Osipov <mi...@apache.org>.
On 2024/01/29 20:28:05 Aryeh Friedman wrote:
> We need to shrink the size of catalina.out but looking at the logging
> documentation I do not see any way to do this with the standard
> logging.properties (or else where).   Due to the nature of the
> production site we never bring it completely down unless we must (life
> critical 24/7/365)
> 
> Specifically we have a fair number of System.out.println's with
> debugging information to it and we dumb stack traces into it also.
> And without stopping and restarting tomcat we want to make it so there
> is periodic rotation of catalina.out to some other file?   (note stack
> traces do go to the dated one but not the System.out.println's)

If you use the FreeBSD port, it will automatically use commons-daemon. JSVC does support SIGUSR1 with reopening logs: https://github.com/apache/commons-daemon/blob/6a95175ba875977a59fa4be2e99d80d2fa8d053a/src/native/unix/native/jsvc-unix.c#L124-L127
Then, you can use newsyslogd to rotate with SIGUSR1.  This works for me for ages now:
/usr/local/ldadocgen/prod/tomcat-1/logs/catalina.out    ldadocgen:ldadocgen    0640    30    *    @T00    GBXP    /var/run/tomcat_ldadocgen_prod_1.pid    SIGUSR1

Michael

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