smartgears: install the logback configuration from a template, if not instructed to use the old way. See https://support.d4science.org/issues/9576

This commit is contained in:
Andrea Dell'Amico 2017-09-04 20:02:37 +02:00
parent 0908b0bbd6
commit 30c4f0e415
3 changed files with 111 additions and 2 deletions

View File

@ -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: [ '' ]

View File

@ -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

View File

@ -0,0 +1,94 @@
<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>
</encoder>
<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>
<totalSizeCap>{{ smartgears_log_total_file_cap }}</totalSizeCap>
</rollingPolicy>
</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>
</encoder>
<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>
<maxHistory>{{ smartgears_log_max_history }}</maxHistory>
<totalSizeCap>{{ smartgears_log_total_file_cap }}</totalSizeCap>
</rollingPolicy>
</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>
</encoder>
<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>
<maxHistory>{{ smartgears_log_max_history }}</maxHistory>
<totalSizeCap>{{ smartgears_log_total_file_cap }}</totalSizeCap>
</rollingPolicy>
</appender>
{% if dataminer_app_install is defined and dataminer_app_install %}
<appender name="ANALYSIS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>{{ smartgears_log_dir }}/analysis.log</file>
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n
</pattern>
</encoder>
<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>
<maxHistory>{{ smartgears_log_max_history }}</maxHistory>
<totalSizeCap>{{ smartgears_log_total_file_cap }}</totalSizeCap>
</rollingPolicy>
</appender>
<logger name="org.gcube.dataanalysis" level="{{ smartgears_dataanalysis_loglevel }}">
<appender-ref ref="ANALYSIS" />
</logger>
{% endif %}
<logger name="org.gcube.data.publishing" level="FATAL">
<appender-ref ref="ACCOUNT_FILE" />
</logger>
<logger name="org.gcube.documentstore" level="FATAL">
<appender-ref ref="ACCOUNT_FILE" />
</logger>
<logger name="org.gcube.smartgears.handlers.application.request"
level="INFO">
<appender-ref ref="ACCESS_FILE" />
</logger>
<logger name="org.gcube" level="{{ smartgears_loglevel }}" />
<logger name="org.gcube.smartgears" level="{{ smartgears_loglevel }}" />
<logger name="org.gcube.common.events" level="{{ smartgears_loglevel }}" />
<logger name="org.gcube.data.publishing" level="FATAL" />
<logger name="org.gcube.documentstore" level="FATAL" />
<root level="{{ smartgears_loglevel }}">
<appender-ref ref="FILE" />
</root>
</configuration>