Libraries#

SLF4J#

  • WEB-INF/lib/slf4j-api.jar

  • WEB-INF/lib/slf4j-jdk14.jar

Configuration#

  • ${catalina.base}/conf/logging.properties

  • WEB-INF/classes/logging.properties

Log Handler#

Daily Log Rotation#

org.apache.juli.FileHandler.directory = ${catalina.base}/logs/${classloader.webappName}
org.apache.juli.FileHandler.prefix = debug.
org.apache.juli.FileHandler.maxDays = 7
org.apache.juli.FileHandler.formatter = java.util.logging.SimpleFormatter

Size-based Log Rotation#

java.util.logging.FileHandler.pattern = ${catalina.base}/logs/${classloader.webappName}/debug.%g
java.util.logging.FileHandler.limit = 1048576
java.util.logging.FileHandler.count = 10
java.util.logging.FileHandler.append = true
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter

Formatter#

See also:

Security Manager#

grant codeBase "`file:${catalina.home}/bin/tomcat-juli.jar <file:$%7Bcatalina.home%7D/bin/tomcat-juli.jar>`__" {
``        permission java.lang.RuntimePermission “accessClassInPackage.sun.util.logging.resources”;``
``        // Allow Tomcat JULI to read web application logging configuration.``
``        permission java.io.FilePermission “/usr/share/pki/server/webapps/pki/WEB-INF/classes/logging.properties”, “read”;``
``        // Allow Tomcat JULI to generate web application log files.``
``        permission java.io.FilePermission “${catalina.base}/logs/pki/-“, “read,write”;``
};

References#