Skip to content

Commit

Permalink
Fix FITS web service logging.
Browse files Browse the repository at this point in the history
- Add log4j.properties.j2
- Add task to move template into place
- Set default variable
- Fix comment
- Resolves Islandora/documentation#460
- Resolves yorkulibraries/yudl-playbook#13
  • Loading branch information
ruebot committed Nov 4, 2020
1 parent d5c1c38 commit bb45013
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 1 deletion.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ fits_install_symlink: /opt/fits
fits_user: tomcat8
fits_group: tomcat8
fits_ws: yes
fits_log_path: /var/log/tomcat8
crayfits_home: /var/www/html
fits_src_url: "https://github.com/harvard-lts/fits/releases/download/{{ fits_version }}/fits-{{ fits_version }}.zip"
fits_zip_md5sum: "md5: 670dd59b1369548cd478ce5acb5d7579"
Expand Down
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
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

0 comments on commit bb45013

Please sign in to comment.