[OODT-983] Updated resource manager to use slf4j and log4j2. Redirected JUL logs to slf4j.
diff --git a/resource/pom.xml b/resource/pom.xml
index 38343a5..6f1ebdd 100644
--- a/resource/pom.xml
+++ b/resource/pom.xml
@@ -139,7 +139,7 @@
<phase>package</phase>
</execution>
</executions>
- </plugin>
+ </plugin>
</plugins>
</build>
<dependencies>
@@ -202,6 +202,11 @@
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</dependency>
+ <!-- Logging - JUL to SLF4J -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jul-to-slf4j</artifactId>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
diff --git a/resource/src/main/bin/resmgr b/resource/src/main/bin/resmgr
index 9a59d32..db948f8 100644
--- a/resource/src/main/bin/resmgr
+++ b/resource/src/main/bin/resmgr
@@ -50,6 +50,7 @@
echo -n "Starting cas resource manager: "
$JAVA_HOME/bin/java -Djava.ext.dirs=${CAS_RESMGR_HOME}/lib \
-Djava.util.logging.config.file=${CAS_RESMGR_HOME}/etc/logging.properties \
+ -Dlog4j.configurationFile=${CAS_RESMGR_HOME}/etc/log4j2.xml \
-Dorg.apache.oodt.cas.resource.properties=${CAS_RESMGR_PROPS} \
org.apache.oodt.cas.resource.system.ResourceManagerMain --portNum $SERVER_PORT &
echo $! >${RUN_HOME}/cas.resmgr.pid
diff --git a/resource/src/main/bin/resmgr-client b/resource/src/main/bin/resmgr-client
index 0376b66..d8f64fb 100644
--- a/resource/src/main/bin/resmgr-client
+++ b/resource/src/main/bin/resmgr-client
@@ -29,6 +29,7 @@
-Djava.ext.dirs=../lib \
-Dorg.apache.oodt.cas.resource.properties=../etc/resource.properties \
-Djava.util.logging.config.file=../etc/logging.properties \
+ -Dlog4j.configurationFile=../etc/log4j2.xml \
-Dorg.apache.oodt.cas.cli.action.spring.config=../policy/cmd-line-actions.xml \
-Dorg.apache.oodt.cas.cli.option.spring.config=../policy/cmd-line-options.xml \
org.apache.oodt.cas.resource.system.ResourceManagerClientMain $*
diff --git a/resource/src/main/resources/log4j2.xml b/resource/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..80bbf2b
--- /dev/null
+++ b/resource/src/main/resources/log4j2.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You 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 permissions and
+ ~ limitations under the License.
+ -->
+
+<Configuration status="INFO">
+
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ </Console>
+ <RollingFile name="RollingFile" fileName="../logs/cas_resmgr.log"
+ filePattern="../logs/cas_resmgr-%i.log">
+ <PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ <Policies>
+ <OnStartupTriggeringPolicy/>
+ <SizeBasedTriggeringPolicy size="10 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="10"/>
+ </RollingFile>
+ </Appenders>
+
+ <Loggers>
+ <Logger name="org.springframework" level="error"/>
+ <Logger name="org.mortbay" level="error"/>
+
+ <Root level="info">
+ <AppenderRef ref="Console"/>
+ <AppenderRef ref="RollingFile"/>
+ </Root>
+ </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/resource/src/main/resources/logging.properties b/resource/src/main/resources/logging.properties
index a7a3da0..c417673 100644
--- a/resource/src/main/resources/logging.properties
+++ b/resource/src/main/resources/logging.properties
@@ -17,25 +17,17 @@
# Specify the handlers to create in the root logger
# (all loggers are children of the root logger)
# The following creates two handlers
-handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
+handlers = org.slf4j.bridge.SLF4JBridgeHandler
+# =================================================
+# Use "logj2.xml" to set log levels if SLF4JBridgeHandler is used.
+# ===========================================
# Set the default logging level for the root logger
-.level = DEBUG
+# .level = DEBUG
-# Set the default logging level for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.level = DEBUG
-java.util.logging.FileHandler.level = DEBUG
-
-# Set the default formatter for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+# Set the default logging level for SLF4JBridgeHandler instances
+# org.slf4j.bridge.SLF4JBridgeHandler.level = DEBUG
-# default file output is in user's home directory.
-java.util.logging.FileHandler.pattern = ../logs/cas_resource%g.log
-java.util.logging.FileHandler.limit = 50000
-java.util.logging.FileHandler.count = 5
-java.util.logging.FileHandler.append = true
-java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
-
# Set the default logging level for the subsystems
# batchmgr subsystem