Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Fix FITS web service logging. #8

Merged
merged 5 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tasks/config-ws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,14 @@
path: "{{ tomcat8_home }}/conf/catalina.properties"
line: 'shared.loader=${fits.home}/lib/*.jar'
notify: restart tomcat8

- name: Wait for FITS to finish coming back up
wait_for:
path: "{{ tomcat8_home }}/webapps/fits/WEB-INF/classes"
state: present

- name: Configure FITS web service logging
template:
src: log4j.properties.j2
dest: "{{ tomcat8_home }}/webapps/fits/WEB-INF/classes/log4j.properties"
notify: restart tomcat8
2 changes: 1 addition & 1 deletion tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: create Fits destination dir
- name: create FITS destination dir
file:
path: "{{ fits_install_root }}/fits-{{ fits_version }}"
state: directory
Expand Down
7 changes: 5 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---

# Include OS specific variables
- name: include OS specific variables
include_vars: "vars/{{ ansible_os_family }}.yml"

- include: install.yml
tags:
- fits
Expand All @@ -18,9 +22,8 @@
- fits-ws
- fits-ws-config
when: fits_ws

- include: build-fits-site.yml
tags:
- fits
- fits-install

77 changes: 77 additions & 0 deletions templates/log4j.properties.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#
# Copyright (c) 2016 by The President and Fellows of Harvard College
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy of the License at:
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software distributed under the License is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permission and limitations under the License.
#

#------------------------------------------------------------------------------
#
# The following properties set the logging levels and log appender. The
# log4j.rootCategory variable defines the default log level plus one or more
# appenders.
#
# To override the default (rootCategory) log level,
# define a property of the form (see below for available values):
#
# Available logger names:
# CONSOLE The command line console (defaults to standard error output)
# FILE The log file to write to.
#
# Possible Log Levels:
# ERROR - only errors during processing are logged, or FATAL.
# WARN - warnings, errors and fatal are logged.
# INFO - general info messages and all the above are logged.
# DEBUG - more detailed messages and all the above are logged.
# TRACE - the most detailed messages and all the above are logged.
#
# OFF - This will turn off logging for an appender.
#
#------------------------------------------------------------------------------

log4j.rootLogger=INFO, CONSOLE, FILE

# create substitutions for appenders
date-pattern={yyyy-MM-dd HH:mm:ss}

#------------------------------------------------------------------------------
# direct log messages to console
#------------------------------------------------------------------------------
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.Threshold=ERROR
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d${date-pattern} - %5p - %c{1}:%L - %m%n
# Detailed appender for debugging, includes thread name:
#log4j.appender.CONSOLE.layout.ConversionPattern=%d${date-pattern} - %5p - [%t] %c{1}:%L - %m%n

#------------------------------------------------------------------------------
# direct messages to a log file
#
# The following properties configure the Rolling File appender.
# See http://logging.apache.org/log4j/1.2/ for details.
#
#------------------------------------------------------------------------------
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
# The following path is specific to Tomcat. Modify for another server or destination locations.
log4j.appender.FILE.File={{ fits_log_path }}/fits-service.log
#log4j.appender.FILE.File=./fits-service.log
log4j.appender.FILE.Threshold=INFO
log4j.appender.FILE.Append=true
log4j.appender.FILE.MaxFileSize=10MB
log4j.appender.FILE.MaxBackupIndex=10
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d${date-pattern} - %5p - %c{1}:%L - %m%n
# Detailed appender for debugging, includes thread name:
#log4j.appender.FILE.layout.ConversionPattern = %d${date-pattern} - %5p - [%t] %c{1}:%L - %m%n

#----------------------------------------------------------
#
# Class- and package-specific loggers for debugging if necessary

log4j.logger.uk.gov.nationalarchives.droid=FATAL,CONSOLE
log4j.logger.edu.harvard.hul.ois.jhove=FATAL,CONSOLE
log4j.logger.org.apache.tika=FATAL,CONSOLE
4 changes: 3 additions & 1 deletion vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---

httpd_conf_directory: "/etc/apache2"
httpd_conf_directory_enabled: "{{httpd_conf_directory}}/conf-enabled"
fits_log_path: /var/log/tomcat8
apache_service: apache2
apache_restart_state
apache_restart_state: restarted
1 change: 1 addition & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
httpd_conf_directory_enabled: "{{httpd_conf_directory}}/conf.d"
apache_service: httpd
vagrant_ssh_user: apache
fits_log_path: /opt/tomcat/logs