ansible-roles/library/roles/tomcat/templates/log4j.properties.j2

69 lines
3.6 KiB
Django/Jinja

{% if tomcat_send_to_logstash %}
log4j.rootLogger = {{ tomcat_log_level }}, {{ tomcat_logstash_logger }}
{% else %}
log4j.rootLogger = {{ tomcat_log_level }}, {{ tomcat_log_logger }}
{% endif %}
# Define all the appenders
log4j.appender.CATALINA = org.apache.log4j.RollingFileAppender
log4j.appender.CATALINA.File = ${catalina.base}/logs/catalina.log
log4j.appender.CATALINA.Append = true
log4j.appender.CATALINA.Encoding = UTF-8
log4j.appender.CATALINA.Threshold = {{ tomcat_log_rotation_threshold }}
log4j.appender.CATALINA.MaxFileSize = {{ tomcat_log_max_file_size }}
log4j.appender.CATALINA.MaxBackupIndex = {{ tomcat_retain_old_logs }}
log4j.appender.CATALINA.layout = org.apache.log4j.PatternLayout
log4j.appender.CATALINA.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.LOCALHOST = org.apache.log4j.RollingFileAppender
log4j.appender.LOCALHOST.File = ${catalina.base}/logs/localhost.log
log4j.appender.LOCALHOST.Append = true
log4j.appender.LOCALHOST.Encoding = UTF-8
log4j.appender.LOCALHOST.Threshold = {{ tomcat_log_rotation_threshold }}
log4j.appender.LOCALHOST.MaxFileSize = {{ tomcat_log_max_file_size }}
log4j.appender.LOCALHOST.MaxBackupIndex = {{ tomcat_retain_old_logs }}
log4j.appender.LOCALHOST.layout = org.apache.log4j.PatternLayout
log4j.appender.LOCALHOST.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.MANAGER = org.apache.log4j.RollingFileAppender
log4j.appender.MANAGER.File = ${catalina.base}/logs/manager.log
log4j.appender.MANAGER.Append = true
log4j.appender.MANAGER.Encoding = UTF-8
log4j.appender.MANAGER.Threshold = {{ tomcat_log_rotation_threshold }}
log4j.appender.MANAGER.MaxFileSize = {{ tomcat_log_max_file_size }}
log4j.appender.MANAGER.MaxBackupIndex = {{ tomcat_retain_old_logs }}
log4j.appender.MANAGER.layout = org.apache.log4j.PatternLayout
log4j.appender.MANAGER.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.HOST-MANAGER = org.apache.log4j.RollingFileAppender
log4j.appender.HOST-MANAGER.File = ${catalina.base}/logs/host-manager.log
log4j.appender.HOST-MANAGER.Append = true
log4j.appender.HOST-MANAGER.Encoding = UTF-8
log4j.appender.HOST-MANAGER.Threshold = {{ tomcat_log_rotation_threshold }}
log4j.appender.HOST-MANAGER.MaxFileSize = {{ tomcat_log_max_file_size }}
log4j.appender.HOST-MANAGER.MaxBackupIndex = {{ tomcat_retain_old_logs }}
log4j.appender.HOST-MANAGER.layout = org.apache.log4j.PatternLayout
log4j.appender.HOST-MANAGER.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
{% if tomcat_send_to_logstash %}
log4j.appender.LOGSTASH=org.apache.log4j.net.SocketAppender
log4j.appender.LOGSTASH.remoteHost={{ tomcat_logstash_collector_host }}
log4j.appender.LOGSTASH.port={{ tomcat_logstash_collector_socketappender_port }}
log4j.appender.LOGSTASH.ReconnectionDelay={{ tomcat_logstash_collector_socketappender_reconndelay }}
log4j.appender.LOGSTASH.LocationInfo=true
log4j.appender.LOGSTASH.layout = org.apache.log4j.PatternLayout
log4j.appender.LOGSTASH.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
{% endif %}
log4j.appender.CONSOLE = org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Encoding = UTF-8
log4j.appender.CONSOLE.layout = org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
# Configure which loggers log to which appenders
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost] = {{ tomcat_log_level }}, LOCALHOST
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager] =\
{{ tomcat_log_level }}, MANAGER
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager] =\
{{ tomcat_log_level }}, HOST-MANAGER