Modifying java.util.logging.SimpleFormatter format property under Tomcat

后端 未结 5 2010
孤街浪徒
孤街浪徒 2020-12-15 21:04

I am using Tomcat 7.0.28, running under OpenJDK 1.7 on Ubuntu, and am trying to modify the formatting string used by java.util.logging.SimpleFormatter. According to the Jav

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-15 21:34

    java.util.logging.SimpleFormatter.format is indeed documented to be settable in either logging.properties -which does not work for me either- or as a command line argument (java option).

    The command line argument appears to work for me. Because the $JAVA_OPTS variable is going through so much tampering and ends up in eval, this is how I solved it (on Debian, java 1.7.0_07, apache-tomcat-7.0.30)

    $CATALINA_HOME/bin/catalina.sh (line 230):

    JAVA_OPTS="$JAVA_OPTS \"-Djava.util.logging.SimpleFormatter.format=%1\\\$tY-%1\\\$tm-%1\\\$td %1\\\$tH:%1\\\$tM:%1\\\$tS.%1\\\$tL %4\\\$s %3\\\$s %5\\\$s%6\\\$s%n\""
    

提交回复
热议问题