From 30c4f0e4159d0cbcd70a9aecf04330b00e87e796 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 4 Sep 2017 20:02:37 +0200 Subject: [PATCH] smartgears: install the logback configuration from a template, if not instructed to use the old way. See https://support.d4science.org/issues/9576 --- smartgears/smartgears/defaults/main.yml | 6 ++ .../smartgears/tasks/smartgears-app.yml | 13 ++- .../smartgears/templates/logback.xml.j2 | 94 +++++++++++++++++++ 3 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 smartgears/smartgears/templates/logback.xml.j2 diff --git a/smartgears/smartgears/defaults/main.yml b/smartgears/smartgears/defaults/main.yml index edc71145..f172030d 100644 --- a/smartgears/smartgears/defaults/main.yml +++ b/smartgears/smartgears/defaults/main.yml @@ -48,6 +48,12 @@ smartgears_http_port: 9000 smartgears_service_name: 'tomcat-instance-{{ smartgears_http_port }}' smartgears_loglevel: WARN +smartgears_dataanalysis_loglevel: DEBUG +smartgears_log_max_history: 30 +smartgears_log_max_file_size: 10M +smartgears_log_total_file_cap: 2GB +smartgears_log_dir: '{{ smartgears_user_home }}/tomcat/logs' +smartgears_logback_template: True smartgears_tomcat_contexts: [ '' ] diff --git a/smartgears/smartgears/tasks/smartgears-app.yml b/smartgears/smartgears/tasks/smartgears-app.yml index a9479365..086b16e9 100644 --- a/smartgears/smartgears/tasks/smartgears-app.yml +++ b/smartgears/smartgears/tasks/smartgears-app.yml @@ -62,13 +62,22 @@ template: src=change-logback-loglevel.sh.j2 dest=/usr/local/bin/change-logback-loglevel owner=root group=root mode=0755 with_items: '{{ tomcat_m_instances }}' when: not item.skip_smartgears - tags: [ 'smartgears', 'smartgears_loglevel', 'tomcat' ] + tags: [ 'smartgears', 'smartgears_loglevel', 'tomcat', 'logback_conf' ] - name: Change the smartgears log level become: True become_user: '{{ smartgears_user }}' shell: /usr/local/bin/change-logback-loglevel - tags: [ 'smartgears', 'tomcat', 'smartgears_loglevel' ] + when: not smartgears_logback_template + tags: [ 'smartgears', 'tomcat', 'smartgears_loglevel', 'logback_conf' ] + +- name: Install the smartgears logback configuration + become: True + become_user: '{{ smartgears_user }}' + template: src=logback.xml.j2 dest={{ smartgears_instance_path }}/lib/logback.xml + when: smartgears_logback_template + tags: [ 'smartgears', 'smartgears_conf', 'tomcat', 'logback_conf' ] + - name: Remove some wrong symbolic links created by the install/upgrade script file: dest={{ item }} state=absent diff --git a/smartgears/smartgears/templates/logback.xml.j2 b/smartgears/smartgears/templates/logback.xml.j2 new file mode 100644 index 00000000..35a8f2fb --- /dev/null +++ b/smartgears/smartgears/templates/logback.xml.j2 @@ -0,0 +1,94 @@ + + + + {{ smartgears_log_dir }}/ghn.log + true + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n + + + + {{ smartgears_log_dir }}/ghn.%d{yyyy-MM-dd}.log + {{ smartgears_log_max_file_size }} + {{ smartgears_log_max_history }} + {{ smartgears_log_total_file_cap }} + + + + + {{ smartgears_log_dir }}/accounting.log + true + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n + + + + {{ smartgears_log_dir }}/accounting.%d{yyyy-MM-dd}.log + + {{ smartgears_log_max_file_size }} + {{ smartgears_log_max_history }} + {{ smartgears_log_total_file_cap }} + + + + + {{ smartgears_log_dir }}/access.log + true + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n + + + + {{ smartgears_log_dir }}/access.%d{yyyy-MM-dd}.log + + {{ smartgears_log_max_file_size }} + {{ smartgears_log_max_history }} + {{ smartgears_log_total_file_cap }} + + + +{% if dataminer_app_install is defined and dataminer_app_install %} + + {{ smartgears_log_dir }}/analysis.log + true + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n + + + + {{ smartgears_log_max_file_size }} + {{ smartgears_log_dir }}/analysis.%d{yyyy-MM-dd}.log + + {{ smartgears_log_max_history }} + {{ smartgears_log_total_file_cap }} + + + + + + +{% endif %} + + + + + + + + + + + + + + + + + + + + + + +