zoukankan      html  css  js  c++  java
  • Tomcat 每天生成 catalina.out

    1.安装cronolog
      wget https://files.cnblogs.com/files/crazyzero/cronolog-1.6.2.tar.gz

      tar -zxvf cronolog-1.6.2.tar.gz

      cd cronolog-1.6.2

      ./configure

      make && make install

      或者 yum install cronolog

    2.检查是否安装成功

      which cronolog

      正常显示 /usr/local/sbin/cronolog

    3.tomcat8.5版本修改catalina.out文件

      直接将第453-491的代码

    shift
      if [ -z "$CATALINA_OUT_CMD" ] ; then
        touch "$CATALINA_OUT"
        catalina_out_command=">> "$CATALINA_OUT" 2>&1"
      else
        catalina_out_command="| $CATALINA_OUT_CMD"
      fi
      if [ ! -z "$CATALINA_PID" ]; then
        catalina_pid_file="$CATALINA_PID"
      else
        catalina_pid_file=/dev/null
      fi
      if [ "$1" = "-security" ] ; then
        if [ $have_tty -eq 1 ]; then
          echo "Using Security Manager"
        fi
        shift
        eval { $_NOHUP ""$_RUNJAVA"" ""$LOGGING_CONFIG"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS
          -D$ENDORSED_PROP=""$JAVA_ENDORSED_DIRS""
          -classpath ""$CLASSPATH""
          -Djava.security.manager
          -Djava.security.policy==""$CATALINA_BASE/conf/catalina.policy""
          -Dcatalina.base=""$CATALINA_BASE""
          -Dcatalina.home=""$CATALINA_HOME""
          -Djava.io.tmpdir=""$CATALINA_TMPDIR""
          org.apache.catalina.startup.Bootstrap "$@" start
          2>&1 && echo $! >"$catalina_pid_file" ; } $catalina_out_command "&"

      else
        eval { $_NOHUP ""$_RUNJAVA"" ""$LOGGING_CONFIG"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS
          -D$ENDORSED_PROP=""$JAVA_ENDORSED_DIRS""
          -classpath ""$CLASSPATH""
          -Dcatalina.base=""$CATALINA_BASE""
          -Dcatalina.home=""$CATALINA_HOME""
          -Djava.io.tmpdir=""$CATALINA_TMPDIR""
          org.apache.catalina.startup.Bootstrap "$@" start
          2>&1 && echo $! >"$catalina_pid_file" ; } $catalina_out_command "&"

      fi

    覆盖替换为

    shift
      #touch "$CATALINA_OUT"
      if [ "$1" = "-security" ] ; then
        if [ $have_tty -eq 1 ]; then
          echo "Using Security Manager"
        fi
        shift
        "$_RUNJAVA" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS
          -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH"
          -Djava.security.manager
          -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy
          -Dcatalina.base="$CATALINA_BASE"
          -Dcatalina.home="$CATALINA_HOME"
          -Djava.io.tmpdir="$CATALINA_TMPDIR"
          org.apache.catalina.startup.Bootstrap "$@" start  2>&1
            | /usr/local/sbin/cronolog "$CATALINA_BASE"/logs/catalina.%Y-%m-%d_%H.out >> /dev/null &

      else
        "$_RUNJAVA" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS
          -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH"
          -Dcatalina.base="$CATALINA_BASE"
          -Dcatalina.home="$CATALINA_HOME"
          -Djava.io.tmpdir="$CATALINA_TMPDIR"
          org.apache.catalina.startup.Bootstrap "$@" start  2>&1
            | /usr/local/sbin/cronolog "$CATALINA_BASE"/logs/catalina.%Y-%m-%d_%H.out >> /dev/null &

      fi

  • 相关阅读:
    【剑指offer】判断二叉树是否为平衡二叉树
    【剑指offer】数字在排序数组中出现的次数
    八大排序方法汇总(选择排序,插入排序-简单插入排序、shell排序,交换排序-冒泡排序、快速排序、堆排序,归并排序,计数排序)
    约瑟夫环问题-循环链表VS数组
    告别2014,你是否感谢这一年的自己?
    浅谈WEB页面提速(前端向)
    HTML5- Canvas入门(七)
    浅谈WEB安全性(前端向)
    是时候搁置Grunt,耍一耍gulp了
    前端神器avalonJS入门(二)
  • 原文地址:https://www.cnblogs.com/xiaofengfree/p/11743665.html
Copyright © 2011-2022 走看看