Add a variable to switch from a time based only logback appender to the new size and time based. The new one needs a logback version newer that the one currently installed. See https://support.d4science.org/issues/9599

This commit is contained in:
Andrea Dell'Amico 2017-09-05 12:43:46 +02:00
parent 30c4f0e415
commit 04c74c3e67
2 changed files with 41 additions and 20 deletions

View File

@ -47,6 +47,7 @@ smartgears_publication_frequency: 300
smartgears_http_port: 9000
smartgears_service_name: 'tomcat-instance-{{ smartgears_http_port }}'
smartgears_log_use_timesize_appender: False
smartgears_loglevel: WARN
smartgears_dataanalysis_loglevel: DEBUG
smartgears_log_max_history: 30

View File

@ -1,50 +1,65 @@
<configuration>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>{{ smartgears_log_dir }}/ghn.log</file>
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n
</pattern>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n</pattern>
</encoder>
{% if smartgears_log_use_timesize_appender %}
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>{{ smartgears_log_dir }}/ghn.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxFileSize>{{ smartgears_log_max_file_size }}</maxFileSize>
<maxHistory>{{ smartgears_log_max_history }}</maxHistory>
<maxFileSize>{{ smartgears_log_max_file_size }}</maxFileSize>
<totalSizeCap>{{ smartgears_log_total_file_cap }}</totalSizeCap>
</rollingPolicy>
{% else %}
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>{{ smartgears_log_dir }}/ghn.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>{{ smartgears_log_max_history }}</maxHistory>
</rollingPolicy>
{% endif %}
</appender>
<appender name="ACCOUNT_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>{{ smartgears_log_dir }}/accounting.log</file>
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n
</pattern>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n</pattern>
</encoder>
{% if smartgears_log_use_timesize_appender %}
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>{{ smartgears_log_dir }}/accounting.%d{yyyy-MM-dd}.log
</fileNamePattern>
<maxFileSize>{{ smartgears_log_max_file_size }}</maxFileSize>
<fileNamePattern>{{ smartgears_log_dir }}/accounting.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>{{ smartgears_log_max_history }}</maxHistory>
<maxFileSize>{{ smartgears_log_max_file_size }}</maxFileSize>
<totalSizeCap>{{ smartgears_log_total_file_cap }}</totalSizeCap>
</rollingPolicy>
{% else %}
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>{{ smartgears_log_dir }}/accounting.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>{{ smartgears_log_max_history }}</maxHistory>
</rollingPolicy>
{% endif %}
</appender>
<appender name="ACCESS_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>{{ smartgears_log_dir }}/access.log</file>
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n
</pattern>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n</pattern>
</encoder>
{% if smartgears_log_use_timesize_appender %}
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>{{ smartgears_log_dir }}/access.%d{yyyy-MM-dd}.log
</fileNamePattern>
<maxFileSize>{{ smartgears_log_max_file_size }}</maxFileSize>
<fileNamePattern>{{ smartgears_log_dir }}/access.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>{{ smartgears_log_max_history }}</maxHistory>
<maxFileSize>{{ smartgears_log_max_file_size }}</maxFileSize>
<totalSizeCap>{{ smartgears_log_total_file_cap }}</totalSizeCap>
</rollingPolicy>
{% else %}
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>{{ smartgears_log_dir }}/access.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>{{ smartgears_log_max_history }}</maxHistory>
</rollingPolicy>
{% endif %}
</appender>
{% if dataminer_app_install is defined and dataminer_app_install %}
@ -52,16 +67,22 @@
<file>{{ smartgears_log_dir }}/analysis.log</file>
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n
</pattern>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n</pattern>
</encoder>
{% if smartgears_log_use_timesize_appender %}
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<maxFileSize>{{ smartgears_log_max_file_size }}</maxFileSize>
<fileNamePattern>{{ smartgears_log_dir }}/analysis.%d{yyyy-MM-dd}.log
</fileNamePattern>
<fileNamePattern>{{ smartgears_log_dir }}/analysis.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>{{ smartgears_log_max_history }}</maxHistory>
<maxFileSize>{{ smartgears_log_max_file_size }}</maxFileSize>
<totalSizeCap>{{ smartgears_log_total_file_cap }}</totalSizeCap>
</rollingPolicy>
{% else %}
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<maxFileSize>{{ smartgears_log_max_file_size }}</maxFileSize>
<fileNamePattern>{{ smartgears_log_dir }}/analysis.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>{{ smartgears_log_max_history }}</maxHistory>
</rollingPolicy>
{% endif %}
</appender>
<logger name="org.gcube.dataanalysis" level="{{ smartgears_dataanalysis_loglevel }}">
@ -87,7 +108,6 @@
<logger name="org.gcube.data.publishing" level="FATAL" />
<logger name="org.gcube.documentstore" level="FATAL" />
<root level="{{ smartgears_loglevel }}">
<appender-ref ref="FILE" />
</root>