Log4J enhancement to use XML configuration.

Patch #1224389 (Martin Hald)


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1399 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Richard Rodgers
2006-01-13 17:17:36 +00:00
parent 9e4cb86aae
commit a8ef55b3cf

View File

@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
###########################################################################
# REMEMBER: ONLY UPDATE THE VERSION IN dspace/config/templates
# AND THEN RUN dspace/bin/install-configs!
# DO NOT EDIT THE 'LIVE' VERSION!
###########################################################################
###########################################################################
#
# log4j.xml
#
# Copyright (c) 2002-2006, Hewlett-Packard Company and Massachusetts
# Institute of Technology. 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 Hewlett-Packard Company nor the name of the
# Massachusetts Institute of Technology nor the names of their
# 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 DSpace, writing daily rolling logs
# 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.properties
-->
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration>
<!-- Standard DSpace file logger -->
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="@@log.dir@@/dspace.log" />
<param name="MaxFileSize" value="1048576" />
<param name="MaxBackupIndex" value="500" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d %-5p %c @ %m%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="FATAL" />
</filter>
</appender>
<!-- Mail adapter, recommended for production systems as it
sends out email when errors level messages occur -->
<appender name="EMAIL" class="org.apache.log4j.net.SMTPAppender">
<param name="BufferSize" value="512" />
<param name="SMTPHost" value="@@mail.server@@" />
<param name="From" value="@@mail.from.address@@" />
<param name="To" value="@@mail.admin@@" />
<param name="Subject" value="[DSpace] Application message" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[%d{ISO8601}]%n%n%%F:-5L%n%n-5p%n%n%c%n%n%m%n%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="ERROR" />
<param name="LevelMax" value="FATAL" />
</filter>
</appender>
<!-- Console adapters, useful for development but should not be
used in production. Standard IDE logging integration with
logging source file and line numbers printed on every statement -->
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ISO8601} [%F:%L] %-5p &lt;%m&gt; %n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="FATAL" />
</filter>
</appender>
<appender name="STDERR" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.err" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ISO8601} [%F:%L] %-5p &lt;%m&gt; %n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="WARN" />
<param name="LevelMax" value="FATAL" />
</filter>
</appender>
<!-- Example for turning up logging in certain packages -->
<logger name="org.apache.sample.package">
<level value="DEBUG" />
</logger>
<!-- Add appenders you want live here -->
<root>
<level value="all" />
<appender-ref ref="FILE" />
<!--
<appender-ref ref="EMAIL" />
<appender-ref ref="STDOUT" />
<appender-ref ref="STDERR" />
-->
</root>
</log4j:configuration>