From 04c74c3e6731c6e9db3f4daf24933afe710639db Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 5 Sep 2017 12:43:46 +0200 Subject: [PATCH] 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 --- smartgears/smartgears/defaults/main.yml | 1 + .../smartgears/templates/logback.xml.j2 | 60 ++++++++++++------- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/smartgears/smartgears/defaults/main.yml b/smartgears/smartgears/defaults/main.yml index f172030d..743c25a4 100644 --- a/smartgears/smartgears/defaults/main.yml +++ b/smartgears/smartgears/defaults/main.yml @@ -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 diff --git a/smartgears/smartgears/templates/logback.xml.j2 b/smartgears/smartgears/templates/logback.xml.j2 index 35a8f2fb..a6d4187d 100644 --- a/smartgears/smartgears/templates/logback.xml.j2 +++ b/smartgears/smartgears/templates/logback.xml.j2 @@ -1,50 +1,65 @@ - {{ smartgears_log_dir }}/ghn.log true - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n - + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n +{% if smartgears_log_use_timesize_appender %} {{ smartgears_log_dir }}/ghn.%d{yyyy-MM-dd}.log - {{ smartgears_log_max_file_size }} {{ smartgears_log_max_history }} + {{ smartgears_log_max_file_size }} {{ smartgears_log_total_file_cap }} +{% else %} + + {{ smartgears_log_dir }}/ghn.%d{yyyy-MM-dd}.log + {{ smartgears_log_max_history }} + +{% endif %} {{ smartgears_log_dir }}/accounting.log true - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n - + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n +{% if smartgears_log_use_timesize_appender %} - {{ smartgears_log_dir }}/accounting.%d{yyyy-MM-dd}.log - - {{ smartgears_log_max_file_size }} + {{ smartgears_log_dir }}/accounting.%d{yyyy-MM-dd}.log {{ smartgears_log_max_history }} + {{ smartgears_log_max_file_size }} {{ smartgears_log_total_file_cap }} +{% else %} + + {{ smartgears_log_dir }}/accounting.%d{yyyy-MM-dd}.log + {{ smartgears_log_max_history }} + +{% endif %} {{ smartgears_log_dir }}/access.log true - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n - + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n +{% if smartgears_log_use_timesize_appender %} - {{ smartgears_log_dir }}/access.%d{yyyy-MM-dd}.log - - {{ smartgears_log_max_file_size }} + {{ smartgears_log_dir }}/access.%d{yyyy-MM-dd}.log {{ smartgears_log_max_history }} + {{ smartgears_log_max_file_size }} {{ smartgears_log_total_file_cap }} +{% else %} + + {{ smartgears_log_dir }}/access.%d{yyyy-MM-dd}.log + {{ smartgears_log_max_history }} + +{% endif %} {% if dataminer_app_install is defined and dataminer_app_install %} @@ -52,16 +67,22 @@ {{ smartgears_log_dir }}/analysis.log true - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n - + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n +{% if smartgears_log_use_timesize_appender %} - {{ smartgears_log_max_file_size }} - {{ smartgears_log_dir }}/analysis.%d{yyyy-MM-dd}.log - + {{ smartgears_log_dir }}/analysis.%d{yyyy-MM-dd}.log {{ smartgears_log_max_history }} + {{ smartgears_log_max_file_size }} {{ smartgears_log_total_file_cap }} +{% else %} + + {{ smartgears_log_max_file_size }} + {{ smartgears_log_dir }}/analysis.%d{yyyy-MM-dd}.log + {{ smartgears_log_max_history }} + +{% endif %} @@ -87,7 +108,6 @@ -