用Java实现的日志切割清理工具 (二)

2014-11-24 07:40:05 · 作者: · 浏览: 2
ry
RUN : Schedule jobs manually
!Q : Shutdown application
: About me
------------------------------------------------------------
> jobs
jobs summary (total: 2, active: 0)
------------------------------------------------------------
1. DelFileRunner@334936591 [ Idle ]
2. CutFileRunner@724646150 [ Idle ]
------------------------------------------------------------
> cfg
configuration summary
------------------------------------------------------------
[global]
start-check-delay : 1 hours
check-interval : 24 hours
log4j-config-file : /Users/Kingfisher/MyWork/Java/LogCutter/classes/../conf/log4j.properties
lock-file : /Users/Kingfisher/MyWork/Java/LogCutter/classes/../LogCutter.lock
[delete-files] (expire: 30 days)
1. /opt/LogCutter/logs/LogCutter.log*
2. /opt/tomcat6-logs/*.log
3. /opt/tomcat7-logs/*.log
[cut-files] (threshold: 30960 KBs, reserve: 1024 KBs)
1. /opt/apache-logs/*_log
2. /opt/nginx-logs/*.log
3. /opt/tomcat6-logs/catalina.out
4. /opt/tomcat7-logs/catalina.out
5. /var/lib/mysql/*.err
------------------------------------------------------------
> run
manual jobs are scheduled !
>
LogCutter 1.0.2 - Bruce Liang, all rights reserved.
------------------------------------------------------------
Description : schedule to DELETE and CUT text log files automatically or manually.
Support : GB18030, UTF-8, UTF-16LE and UTF-16BE text file types.
Usage : java com.bruce.main.LogCutter [ -f ]
(default config file is '/Users/Kingfisher/MyWork/Java/LogCutter/classes/../conf/config.xml')
------------------------------------------------------------
> !q
be about to shutdown, please wait ...
shutdown perfectly !

后台运行演示(Mac 平台):
[Kingfisher@Bruce-mbp LogCutter] $ ./run.sh -d
[Kingfisher@Bruce-mbp LogCutter] $
LogCutter is running in background, use 'kill 4544' to stop me.

[Kingfisher@Bruce-mbp LogCutter] $ kill 4544
[Kingfisher@Bruce-mbp LogCutter] $
!! LogCutter received terminate signal !!
be about to shutdown, please wait ...
shutdown perfectly !

[Kingfisher@Bruce-mbp LogCutter] $

程序运行日志
05:52:20,705 INFO [main]: ->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->
05:52:20,706 INFO [main]: starting: class com.bruce.main.LogCutter ...
05:52:20,707 INFO [main]: configuration summary
------------------------------------------------------------
[global]
start-check-delay : 1 hours
check-interval : 24 hours
log4j-config-file : /Users/Kingfisher/MyWork/Java/LogCutter/classes/../conf/log4j.properties
lock-file : /Users/Kingfisher/MyWork/Java/LogCutter/classes/../LogCutter.lock
[delete-files] (expire: 30 days)
1. /opt/LogCutter/logs/LogCutter.log*
2. /opt/tomcat6-logs/*.log
3. /opt/tomcat7-logs/*.log
[cut-files] (threshold: 30960 KBs, reserve: 1024 KBs)
1. /opt/apache-logs/*_log
2. /opt/nginx-logs/*.log
3. /opt/tomcat6-logs/catalina.out
4. /opt/tomcat7-logs/catalina.out
5. /var/lib/mysql/*.err
------------------------------------------------------------
05:52:39,062 INFO [pool-1-thread-2]: - - - - - - - -> start CutFileRunner@724646150 <- - - - - - - -
05:52:39,062 INFO [pool-1-thread-1]: -