zoukankan      html  css  js  c++  java
  • 使用cronolog工具给tomcat进行日志切割

    关于cronolog的用法查看:https://www.freebsd.org/cgi/man.cgi?query=cronolog&apropos=0&sektion=0&manpath=FreeBSD+7.2-RELEASE+and+Ports&format=html

    或者使用man cronolog:

    [root@weblogic ~]# cronolog -h
    usage: cronolog [OPTIONS] logfile-spec
    
       -H NAME,   --hardlink=NAME maintain a hard link from NAME to current log
       -S NAME,   --symlink=NAME  maintain a symbolic link from NAME to current log
       -P NAME,   --prev-symlink=NAME  maintain a symbolic link from NAME to previous log
       -l NAME,   --link=NAME     same as -S/--symlink
       -h,        --help          print this help, then exit
       -p PERIOD, --period=PERIOD set the rotation period explicitly
       -d DELAY,  --delay=DELAY   set the rotation period delay
       -o,        --once-only     create single output log from template (not rotated)
       -x FILE,   --debug=FILE    write debug messages to FILE
                                  ( or to standard error if FILE is "-")
       -a,        --american         American date formats
       -e,        --european         European date formats (default)
       -s,    --start-time=TIME   starting time
       -z TZ, --time-zone=TZ      use TZ for timezone
       -V,      --version         print version number, then exit

    1、安装cronolog这个工具,这里使用yum进行安装:

    [root@weblogic scripts]# yum whatprovides */cronolog
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    base                                                                                                              | 3.7 kB     00:00     
    epel                                                                                                              | 4.7 kB     00:00     
    epel/primary_db                                                                                                   | 6.0 MB     00:01     
    extras                                                                                                            | 3.4 kB     00:00     
    updates                                                                                                           | 3.4 kB     00:00     
    epel/filelists_db                                                                                                 | 7.8 MB     00:05     
    extras/filelists_db                                                                                               |  26 kB     00:00     
    cronolog-1.6.2-10.el6.x86_64 : Web log rotation program for Apache
    Repo        : epel
    Matched from:
    Filename    : /usr/sbin/cronolog
    [root@weblogic scripts]# yum -y install cronolog

    安装完成后,查看执行程序位置:

    [root@weblogic scripts]# which cronolog
    /usr/sbin/cronolog

    2、使用cronolog给tomcat进行日志切割,修改catalina.sh脚本文件:

    修改之前为:

    org.apache.catalina.startup.Bootstrap "$@" start 
    >> "$CATALINA_OUT" 2>&1 &

    修改完成后,启动tomcat服务,查看日志文件:

    时间查不同,那是因为之前并没有同步时间导致,于是切割tomcat日志成功

  • 相关阅读:
    python的json模块介绍
    采用boosting思想开发一个解决二分类样本不平衡的多估计器模型
    kappa系数
    android服务
    Android Studio 无法预览布局问题:com/android/util/PropertiesMap
    pitch yaw roll是什么
    keil5破解
    Eclipse/jre/jdk/jvm
    传感器
    Java静态代码块
  • 原文地址:https://www.cnblogs.com/jsonhc/p/8179152.html
Copyright © 2011-2022 走看看