From eae20d38d10f99a24eda308b6432035c7ddfdee4 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Thu, 21 Apr 2016 15:02:13 -0500 Subject: [PATCH] Filter all log4j files via Ant. Move log.dir and other logging settings to log4j.properties, and similar. --- dspace/config/dspace.cfg | 27 ++------ dspace/config/log4j-console.properties | 10 ++- dspace/config/log4j-handle-plugin.properties | 65 ++++---------------- dspace/config/log4j-solr.properties | 20 ++++-- dspace/config/log4j.properties | 49 ++++++--------- dspace/src/main/config/build.xml | 16 ++--- 6 files changed, 62 insertions(+), 125 deletions(-) diff --git a/dspace/config/dspace.cfg b/dspace/config/dspace.cfg index b3bca79851..3d939e1241 100644 --- a/dspace/config/dspace.cfg +++ b/dspace/config/dspace.cfg @@ -7,11 +7,6 @@ # * JSPUI Specific Configurations # * XMLUI Specific Configurations # -# Revision: $Revision$ -# -# Date: $Date$ -# - #------------------------------------------------------------------# #------------------GENERAL CONFIGURATIONS--------------------------# @@ -166,27 +161,12 @@ mail.allowed.referrers = ${dspace.hostname} # Moved to config/spring/bitstore.xml ##### Logging configuration ##### - -# Override default log4j configuration +# Override default log4j configuration file # You may provide your own configuration here, existing alternatives are: -# log.init.config = ${dspace.dir}/config/log4j.xml # log.init.config = ${dspace.dir}/config/log4j-console.properties log.init.config = ${dspace.dir}/config/log4j.properties -# Where to put the logs (used in configuration only) -log.dir = ${dspace.dir}/log - -# loglevel.dspace: Log level for all DSpace-specific code (org.dspace.*) -# Possible values (from most to least info): DEBUG, INFO, WARN, ERROR, FATAL -loglevel.dspace = INFO - -# loglevel.other: Log level for other third-party tools/APIs used by DSpace -# Possible values (from most to least info): DEBUG, INFO, WARN, ERROR, FATAL -loglevel.other = INFO - -# If enabled, the logging and the Solr statistics system will look for -# an X-Forwarded-For header. If it finds it, it will use this for the user IP address -#useProxies = true +# All other log4j settings moved to config/log4j.properties ##### DOI registration agency credentials ###### # To mint DOIs you have to use a DOI registration agency like DataCite. Several @@ -344,6 +324,9 @@ http.proxy.host = # port number of proxy server http.proxy.port = +# If enabled, the logging and the Solr statistics system will look for +# an X-Forwarded-For header. If it finds it, it will use this for the user IP address +#useProxies = true #### Media Filter / Format Filter plugins (through PluginService) #### # Media/Format Filters help to full-text index content or diff --git a/dspace/config/log4j-console.properties b/dspace/config/log4j-console.properties index c59b8ad7b3..6d441dd447 100644 --- a/dspace/config/log4j-console.properties +++ b/dspace/config/log4j-console.properties @@ -1,6 +1,10 @@ -########################################################## -# Simple log4j configuration file used during build tasks -########################################################## +############################################################# +# log4j-console.properties +# +# Simple log4j configuration file used during Ant build tasks +# +# Its goal is to simply output logs to the commandline / console. +############################################################# # Set root category priority to INFO and its only appender to A1. log4j.rootCategory=INFO, A1 diff --git a/dspace/config/log4j-handle-plugin.properties b/dspace/config/log4j-handle-plugin.properties index 3b68a301d6..44d39fb1bd 100644 --- a/dspace/config/log4j-handle-plugin.properties +++ b/dspace/config/log4j-handle-plugin.properties @@ -1,63 +1,20 @@ ########################################################################### -# REMEMBER: ONLY UPDATE THE VERSION IN dspace/config/templates -# AND THEN RUN dspace/bin/install-configs! -# DO NOT EDIT THE 'LIVE' VERSION! -########################################################################### - -########################################################################### -# # log4j-handle-plugin.properties # -# Version: $Revision$ -# -# Date: $Date$ -# -# Copyright (c) 2002-2009, The DSpace Foundation. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# - Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# - Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# - Neither the name of the DSpace Foundation nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -# DAMAGE. -# +# This is the log4j configuration file for the embedded DSpace Handle server, +# writing daily rolling logs. We cannot simply write to the same logs, since +# log4j does not support more than one JVM writing to the same rolling log. ########################################################################### -# This is the log4j configuration file for the DSpace Handle server, writing -# daily rolling logs. We cannot simply write to the same logs, since log4j -# does not support more than one JVM writing to the same rolling log. - -# Text surrounded by two '@' symbols is replaced with the corresponding -# property from dspace.cfg. For example: -# -# @@dspace.url@@ -# -# would be replaced with the dspace.url property in dspace.cfg. -# When /dspace/bin/install-configs is run, this file will be installed in the -# location specified by the property: -# config.template.log4j-handle-plugin.properties +# VARIABLES: +# The following variables can be used to easily tweak the default log4j settings. +# These variables are used by the log4j config / appenders later in this file. +# log.dir +# Default log file directory for DSpace. Defaults to the 'log' subdirectory +# under [dspace.dir]. NOTE: The value of 'dspace.dir' will be replaced by +# its value in your configuration when DSpace is deployed (via Ant). +log.dir=${dspace.dir}/log # Set root category priority to INFO and its only appender to A1. log4j.rootCategory=INFO, A1 diff --git a/dspace/config/log4j-solr.properties b/dspace/config/log4j-solr.properties index 2989ac7e3c..c94e384d81 100644 --- a/dspace/config/log4j-solr.properties +++ b/dspace/config/log4j-solr.properties @@ -1,13 +1,23 @@ ########################################################################### # log4j-solr.properties -########################################################################### - +# # This is the log4j configuration file for the Solr webapp that comes bundled -# with DSpace. Because Solr is a dependency, its log4j settings are kept separate -# from the default DSpace log4j settings (in log4j.properties). +# with DSpace. Because Solr is a dependency, its log4j settings are kept +# separate from the default DSpace log4j settings (in log4j.properties). # # Therefore, this log4j file is standalone. If you wish to tweak the location of -# your Solr logs, you must do so within this file (or in your DSpace source code). +# your Solr logs, you must do so within this file. +########################################################################### + +# VARIABLES: +# The following variables can be used to easily tweak the default log4j settings. +# These variables are used by the log4j config / appenders later in this file. + +# log.dir +# Default log file directory for DSpace. Defaults to the 'log' subdirectory +# under [dspace.dir]. NOTE: The value of 'dspace.dir' will be replaced by +# its value in your configuration when DSpace is deployed (via Ant). +log.dir=${dspace.dir}/log # Logging level for Solr log4j.rootLogger=INFO, file diff --git a/dspace/config/log4j.properties b/dspace/config/log4j.properties index b40dc61e5f..238d0d8fbf 100644 --- a/dspace/config/log4j.properties +++ b/dspace/config/log4j.properties @@ -1,46 +1,33 @@ ########################################################################### -# # log4j.properties # -# Version: $Revision$ -# -# Date: $Date$ -# +# This is the primary log4j (logging) configuration file for DSpace. By default, +# Log4j is configured to write log files that rotate daily. However, you may +# tweak these settings based on your local needs / best practices. +# For more information on log4j configuration, see: +# https://logging.apache.org/log4j/1.2/manual.html ########################################################################### -# This is the log4j configuration file for DSpace. Log4j can be configured to -# write files that rotate every day or every month. -# -# Some specific variables/properties are specified in the log4j settings below. -# These properties are given default values in this log4j configuration file, -# HOWEVER they will be overridden by a property of the same name within your -# DSpace Configuration. For example, the default value of ${log.dir} will be -# overridden by the "log.dir" setting within dspace.cfg or local.cfg. -# -# The default settings below MUST be retained here as they will be used by the -# DSpaceKernel during startup until the point where log4j is fully configured -# by LoggerServiceImpl. Once LoggerServiceImpl is initialized (after Kernel -# startup & configuration init), these values will be overridden by ones in -# the DSpaceConfigurationService. -# For more information, see LoggerServiceImpl class. -# -# PARAMETERS: -# [WARNING:] Please be sure to retain the uncommented, default values here. -# If you wish to update a value, do so within your local.cfg file, and it will -# automatically override the default setting below. -# +# VARIABLES: +# The following variables can be used to easily tweak the default log4j settings. +# These variables are used by the log4j config / appenders later in this file. + # log.dir -# Default log file directory for DSpace. Often set to ${dspace.dir}/log in dspace.cfg -log.dir=../log -# +# Default log file directory for DSpace. Defaults to the 'log' subdirectory +# under [dspace.dir]. NOTE: The value of 'dspace.dir' will be replaced by +# its value in your configuration when DSpace is deployed (via Ant). +log.dir=${dspace.dir}/log + # loglevel.dspace # Log level for all DSpace-specific code (org.dspace.*) # Possible values (from most to least info): DEBUG, INFO, WARN, ERROR, FATAL +# Defaults to INFO loglevel.dspace=INFO -# + # loglevel.other # Log level for other third-party tools/APIs used by DSpace # Possible values (from most to least info): DEBUG, INFO, WARN, ERROR, FATAL +# Defaults to INFO loglevel.other=INFO ########################################################################### @@ -69,7 +56,7 @@ log4j.appender.A1.layout.ConversionPattern=%d %-5p %c @ %m%n ########################################################################### -# A2 is the name of the appender for the Checker +# A2 is the name of the appender for the Checksum Checker ########################################################################### # This line sets the logging level for the checksum checker log file. # Set this to DEBUG to see extra detailed logging. diff --git a/dspace/src/main/config/build.xml b/dspace/src/main/config/build.xml index 1ffeaa64a3..ecc77a9c53 100644 --- a/dspace/src/main/config/build.xml +++ b/dspace/src/main/config/build.xml @@ -350,13 +350,13 @@ Common usage: + MOST config files are now auto-interpolated at runtime and don't need filtering! --> - - + + @@ -767,10 +767,7 @@ Common usage: - + @@ -781,7 +778,6 @@ Common usage: -