在将Apache Tomcat作为Windows服务运行时,如何限制stdout.log文件的大小? [英] How to limit stdout.log file size when running Apache Tomcat as Windows service?
问题描述
有什么方法可以限制Apache Tomcat中stdout.log
文件的大小?作为服务运行时,system.out
语句转到标准输出文件.但是我需要一种机制,可以在达到2GB大小或类似大小后通过创建新文件来控制stdout日志文件的大小.到目前为止,每天都会创建一个新文件,但这还不够.
Is there any way that I could limit the size of the stdout.log
file in Apache Tomcat? When running as a service system.out
statements go to the stdout file. But I need to have a mechanism where I can control the size of the stdout log file by creating new files after reaching 2GB size or something like that. As of now a new file is created everyday but that is not sufficient.
推荐答案
在Windows中,您可以转到Program Files\Apache Software Foundation\Tomcat6.0\bin
并以管理员身份运行tomcat6w.exe
在"Java"选项卡下的"Java选项"部分中,添加以下内容:
-Djava.util.logging.FileHandler.limit=25000000
In Windows you can go to go to Program Files\Apache Software Foundation\Tomcat6.0\bin
and run tomcat6w.exe
as administrator
Under the Java tab, in the Java Options section add the following:
-Djava.util.logging.FileHandler.limit=25000000
这会将默认的stdout.log
文件设置为25MBs
,然后再旋转到新的日志文件.
This will set the default stdout.log
file to 25MBs
before it rotates to a new log file.
这篇关于在将Apache Tomcat作为Windows服务运行时,如何限制stdout.log文件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!