每100 MB大小轮换日志文件 [英] Rotate log file for every 100 MB size

查看:98
本文介绍了每100 MB大小轮换日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有启动Java进程的Windows批处理脚本.该过程运行一周,问题是该过程的日志文件非常大(大约10 GB).在诸如NotePad ++,EditPlus和TextPad之类的编辑器中打开此日志文件时,我遇到问题. 当大小达到100 mb时,我可以获取命令以添加到我的启动批处理脚本中来旋转日志文件的信息.这将是很大的帮助.

I have windows batch script which starts a java process. This process runs for a week, the problem is ow a days log file of this process is very huge(around 10 GB). I am facing problem while opening this log file in editor like NotePad++, EditPlus and TextPad. Please can I get command to add in my start up batch script for rotating log file when size reaches to 100 mb. It would be a great help.

推荐答案

如果登录log4j,则可以配置最大文件大小.在此处

If you are logging in log4j you can configure the max file size. See a previous question here

例如在Java中(而不是批处理文件中)或在log4j的配置文件中*使用适当的最大大小):

e.g. In the java (rather than the batch file) or in log4j's configuration file *using a suitable max size):

log4j.appender.file.MaxFileSize=1MB

这篇关于每100 MB大小轮换日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆