1. 安装cronologs

    tar zxvf cronolog-1.7.0-beta.tar.gz

    cd cronolog/

    ./configure  --prefix=/data/xxx/cronologs/

    make  && make  install

    which cronolog查安看装的路径,编译目录/data/xxx/cronologs/sbin/cronolog。

2.修改catalina.sh

  

    第一步:

    if [ -z "$CATALINA_OUT" ] ; then

      CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out

    fi

   

    if [ -z "$CATALINA_OUT" ] ; then

      CATALINA_OUT="$CATALINA_BASE"/logs/catalina.%Y-%m-%d.out

    fi

    第二步:

    

    touch "$CATALINA_OUT"

    修改为

    #  touch "$CATALINA_OUT"

    第三步:


    org.apache.catalina.startup.Bootstrap "$@" start \

    >> "$CATALINA_OUT" 2>&1 "&"

    修改为

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

    | /usr/local/sbin/cronolog "$CATALINA_OUT" >> /dev/null & 


3.重启tomcat

    重启tomcat后发下logs目录下,多了一个catalina.2016-03-27.log