[DS-3135] Tell Log4J where to find its configuration.

This commit is contained in:
Mark H. Wood
2018-10-14 15:21:41 -04:00
committed by Mark H. Wood
parent 5cbe4fefb5
commit 3f904dc4ec
9 changed files with 54 additions and 9 deletions

View File

@@ -20,6 +20,11 @@
<param-value>${dspace.dir}</param-value>
</context-param>
<context-param>
<param-name>log4jConfiguration</param-name>
<param-value>${dspace.dir}/config/log4j2.xml</param-value>
<description>The location of the Log4J configuration</description>
</context-param>
<!-- Location of root application context configs (to be loaded by ContextLoaderListener below) -->
<!-- This contains the beans that initialize DSpace Services -->

View File

@@ -22,6 +22,14 @@
<param-value>${dspace.dir}</param-value>
</context-param>
<context-param>
<param-name>log4jConfiguration</param-name>
<param-value>${dspace.dir}/config/log4j2.xml</param-value>
<description>
The location of the Log4J configuration
</description>
</context-param>
<filter>
<filter-name>dspace.request</filter-name>
<filter-class>org.dspace.utils.servlet.DSpaceWebappServletFilter</filter-class>

View File

@@ -76,6 +76,14 @@
<param-value>${dspace.dir}</param-value>
</context-param>
<context-param>
<param-name>log4jConfiguration</param-name>
<param-value>${dspace.dir}/config/log4j2.xml</param-value>
<description>
The location of the Log4J configuration
</description>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>

View File

@@ -45,9 +45,11 @@
initialized until the DSpace Kernel starts up, and we don't want Solr to
depend on the DSpace Kernel/API -->
<context-param>
<param-name>log4j.configuration</param-name>
<param-name>log4jConfiguration</param-name>
<param-value>${dspace.dir}/config/log4j-solr.properties</param-value>
<description>URL locating a Log4J configuration file (properties or XML).</description>
<description>
URL locating a Log4J configuration file (properties or XML).
</description>
</context-param>
<!-- Any path (name) registered in solrconfig.xml will be sent to that filter -->

View File

@@ -113,3 +113,7 @@ spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSou
#logging.level.org.springframework.boot=DEBUG
#logging.level.org.springframework.web=DEBUG
#logging.level.org.hibernate=ERROR
#########################
# Log4J configuration
server.context-parameters.log4jConfiguration=${dspace.dir}/config/log4j2.xml

View File

@@ -27,6 +27,14 @@
<param-value>org.dspace.sword.DSpaceSWORDServer</param-value>
</context-param>
<context-param>
<param-name>log4jConfiguration</param-name>
<param-value>${dspace.dir}/config/log4j2.xml</param-value>
<description>
The location of the Log4J configuration
</description>
</context-param>
<context-param>
<description>The type of authentication used : [Basic|None]</description>
<param-name>authentication-method</param-name>

View File

@@ -29,7 +29,16 @@
<param-value>org.dspace.sword2.ServiceDocumentManagerDSpace</param-value>
</context-param>
<!-- this can be omitted if the server does not wish to support listing collection contents -->
<context-param>
<param-name>log4jConfiguration</param-name>
<param-value>${dspace.dir}/config/log4j2.xml</param-value>
<description>
The location of the Log4J configuration
</description>
</context-param>
<!-- This can be omitted if the server does not wish to support
listing collection contents -->
<context-param>
<description>The CollectionListManager server implementation class name</description>
<param-name>collection-list-impl</param-name>

View File

@@ -35,8 +35,6 @@ if [ "$1" = "classpath" ]; then
exit 0
fi
#Allow user to specify java options through JAVA_OPTS variable
if [ "$JAVA_OPTS" = "" ]; then
#Default Java to use 256MB of memory
@@ -44,4 +42,7 @@ if [ "$JAVA_OPTS" = "" ]; then
fi
# Now invoke Java
java $JAVA_OPTS -classpath $FULLPATH org.dspace.app.launcher.ScriptLauncher "$@"
java $JAVA_OPTS \
-classpath $FULLPATH \
-Dlog4j.configurationFile=$DSPACEDIR/config/log4j2.xml \
org.dspace.app.launcher.ScriptLauncher "$@"

View File

@@ -39,7 +39,7 @@ REM Otherwise, default Java to using 256MB of memory
if "%JAVA_OPTS%"=="" set "JAVA_OPTS=-Xmx256m -Dfile.encoding=UTF-8"
REM Execute Java
java %JAVA_OPTS% -classpath "%DSPACE_CLASSPATH%" org.dspace.app.launcher.ScriptLauncher %*
java %JAVA_OPTS% -classpath "%DSPACE_CLASSPATH%" -Dlog4j.configurationFile=%DSPACEDIR%/config/log4j2.xml org.dspace.app.launcher.ScriptLauncher %*
REM Clean up DSPACE_CLASSPATH variable
set DSPACE_CLASSPATH=