[hornetq-commits] JBoss hornetq SVN: r8051 - in trunk: examples/common/config and 22 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Oct 6 05:31:01 EDT 2009
Author: timfox
Date: 2009-10-06 05:31:00 -0400 (Tue, 06 Oct 2009)
New Revision: 8051
Added:
trunk/src/main/org/hornetq/core/logging/LogDelegate.java
trunk/src/main/org/hornetq/core/logging/LogDelegateFactory.java
trunk/src/main/org/hornetq/core/logging/impl/
trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegate.java
trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegateFactory.java
trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegate.java
trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegateFactory.java
trunk/tests/src/org/hornetq/tests/integration/logging/
trunk/tests/src/org/hornetq/tests/integration/logging/LogDelegateTest.java
trunk/tests/src/org/hornetq/tests/integration/logging/MyLogDelegateFactory.java
Removed:
trunk/src/main/org/hornetq/integration/logging/BaseLoggerHandler.java
trunk/src/main/org/hornetq/integration/logging/HornetQLoggerPlugin.java
trunk/src/main/org/hornetq/integration/logging/Log4jLoggerHandler.java
Modified:
trunk/build-hornetq.xml
trunk/examples/common/config/server.properties
trunk/examples/common/src/org/hornetq/common/example/SpawnedHornetQServer.java
trunk/examples/jms/client-kickoff/ant.properties
trunk/examples/jms/jmx/ant.properties
trunk/examples/jms/large-message/ant.properties
trunk/examples/jms/message-counters/ant.properties
trunk/examples/jms/paging/ant.properties
trunk/examples/jms/symmetric-cluster/ant.properties
trunk/examples/jms/xa-heuristic/ant.properties
trunk/src/bin/run.bat
trunk/src/bin/run.sh
trunk/src/config/common/schema/hornetq-configuration.xsd
trunk/src/config/jboss-as/clustered/hornetq-configuration.xml
trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml
trunk/src/main/org/hornetq/core/config/Configuration.java
trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
trunk/src/main/org/hornetq/core/logging/Logger.java
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
trunk/tests/config/ConfigurationTest-full-config.xml
trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java
trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-167
Modified: trunk/build-hornetq.xml
===================================================================
--- trunk/build-hornetq.xml 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/build-hornetq.xml 2009-10-06 09:31:00 UTC (rev 8051)
@@ -186,7 +186,6 @@
<path id="logging.compilation.classpath">
<path refid="log4j.log4j.classpath"/>
- <path refid="org.jboss.logging.classpath"/>
</path>
<path id="javadoc.classpath">
@@ -255,7 +254,6 @@
<path refid="org.jboss.logging.classpath"/>
<path refid="jboss.jbossts.classpath"/>
<path refid="apache.xerces.classpath"/>
- <path refid="apache.logging.classpath"/>
<path refid="log4j.log4j.classpath"/>
</path>
@@ -280,7 +278,6 @@
<path refid="org.jboss.naming.classpath"/>
<path refid="jboss.jbossts.classpath"/>
<path refid="apache.xerces.classpath"/>
- <path refid="apache.logging.classpath"/>
<path refid="log4j.log4j.classpath"/>
<pathelement location="${test.dir}/config"/>
<pathelement location="${src.config.dir}/common"/>
@@ -1120,8 +1117,6 @@
<jvmarg value="-Djava.library.path=native/bin"/>
<jvmarg value="-Dmodule.output=./"/>
<jvmarg value="-Djava.util.logging.config.file=src/config/trunk/non-clustered/logging.properties"/>
- <jvmarg
- value="-Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin"/>
<jvmarg value="-XX:+PrintClassHistogram"/>
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-verbose:gc"/>
@@ -1176,8 +1171,6 @@
<jvmarg value="-Djava.library.path=native/bin"/>
<jvmarg value="-Dmodule.output=./"/>
<jvmarg value="-Djava.util.logging.config.file=src/config/trunk/non-clustered/logging.properties"/>
- <jvmarg
- value="-Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin"/>
<!--<jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>-->
<!--<jvmarg value="-ea"/>-->
<sysproperty key="java.io.tmpdir" value="${java.io.tmpdir}"/>
@@ -1253,7 +1246,6 @@
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-Dmodule.output=./"/>
<jvmarg value="-Djava.util.logging.config.file=src/config/logging.properties"/>
- <jvmarg value="-Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin"/>
<jvmarg value="-Djava.library.path=native/bin"/>
<!--<jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>-->
@@ -1417,8 +1409,6 @@
<jvmarg value="-XX:+UseFastAccessorMethods"/>
<jvmarg value="-Dcom.sun.management.jmxremote"/>
<jvmarg value="-Djava.util.logging.config.file=${src.config.trunk.clustered.dir}/logging.properties"/>
- <jvmarg
- value="-Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin"/>
<jvmarg value="-Djava.library.path=${native.bin.dir}"/>
<jvmarg value="-Dhornetq.remoting.netty.port=${hornetq.remoting.netty.port}"/>
<jvmarg value="-Djnp.port=${jnp.port}"/>
@@ -1443,8 +1433,6 @@
<jvmarg value="-Dcom.sun.management.jmxremote"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>
<jvmarg value="-Djava.util.logging.config.file=${src.config.standalone.non-clustered.dir}/logging.properties"/>
- <jvmarg
- value="-Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin"/>
<jvmarg value="-Djava.library.path=${native.bin.dir}"/>
<jvmarg value="-Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory"/>
<jvmarg value="-Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"/>
Modified: trunk/examples/common/config/server.properties
===================================================================
--- trunk/examples/common/config/server.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/common/config/server.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/common/src/org/hornetq/common/example/SpawnedHornetQServer.java
===================================================================
--- trunk/examples/common/src/org/hornetq/common/example/SpawnedHornetQServer.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/common/src/org/hornetq/common/example/SpawnedHornetQServer.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -30,8 +30,7 @@
killChecker.start();
System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
- System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
- System.setProperty("org.jboss.logging.Logger.pluginClass", "org.hornetq.integration.logging.HornetQLoggerPlugin");
+ System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
bootstrap = new HornetQBootstrapServer(args);
bootstrap.run();
System.out.println("STARTED::");
Modified: trunk/examples/jms/client-kickoff/ant.properties
===================================================================
--- trunk/examples/jms/client-kickoff/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/client-kickoff/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/jmx/ant.properties
===================================================================
--- trunk/examples/jms/jmx/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/jmx/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/large-message/ant.properties
===================================================================
--- trunk/examples/jms/large-message/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/large-message/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms50M -Xmx50M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms50M -Xmx50M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/message-counters/ant.properties
===================================================================
--- trunk/examples/jms/message-counters/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/message-counters/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/paging/ant.properties
===================================================================
--- trunk/examples/jms/paging/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/paging/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms50M -Xmx50M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms50M -Xmx50M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/symmetric-cluster/ant.properties
===================================================================
--- trunk/examples/jms/symmetric-cluster/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/symmetric-cluster/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms50M -Xmx100M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms50M -Xmx100M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/examples/jms/xa-heuristic/ant.properties
===================================================================
--- trunk/examples/jms/xa-heuristic/ant.properties 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/examples/jms/xa-heuristic/ant.properties 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1 +1 @@
-server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
+server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Modified: trunk/src/bin/run.bat
===================================================================
--- trunk/src/bin/run.bat 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/bin/run.bat 2009-10-06 09:31:00 UTC (rev 8051)
@@ -9,8 +9,8 @@
set CLASSPATH=%CONFIG_DIR%;%HORNETQ_HOME%\schemas\
REM you can use the following line if you want to run with different ports
REM set CLUSTER_PROPS="-Djnp.port=1099 -Djnp.rmiPort=1098 -Djnp.host=localhost -Dhornetq.remoting.netty.host=localhost -Dhornetq.remoting.netty.port=5445"
-set JVM_ARGS=%CLUSTER_PROPS% -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=%CONFIG_DIR% -Djava.util.logging.config.file=%CONFIG_DIR%\logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.library.path=.
-REM export JVM_ARGS="-Xmx512M -Djava.util.logging.config.file=%CONFIG_DIR%\logging.properties -Dhornetq.config.dir=$CONFIG_DIR -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.library.path=. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
+set JVM_ARGS=%CLUSTER_PROPS% -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=%CONFIG_DIR% -Djava.util.logging.config.file=%CONFIG_DIR%\logging.properties -Djava.library.path=.
+REM export JVM_ARGS="-Xmx512M -Djava.util.logging.config.file=%CONFIG_DIR%\logging.properties -Dhornetq.config.dir=$CONFIG_DIR -Djava.library.path=. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
for /R ..\lib %%A in (*.jar) do (
SET CLASSPATH=!CLASSPATH!;%%A
)
Modified: trunk/src/bin/run.sh
===================================================================
--- trunk/src/bin/run.sh 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/bin/run.sh 2009-10-06 09:31:00 UTC (rev 8051)
@@ -10,8 +10,8 @@
export CLASSPATH=$CONFIG_DIR:$HORNETQ_HOME/schemas/
#you can use the following line if you want to run with different ports
#export CLUSTER_PROPS="-Djnp.port=1099 -Djnp.rmiPort=1098 -Djnp.host=localhost -Dhornetq.remoting.netty.host=localhost -Dhornetq.remoting.netty.port=5445"
-export JVM_ARGS="$CLUSTER_PROPS -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=$CONFIG_DIR -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.library.path=."
-#export JVM_ARGS="-Xmx512M -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Dhornetq.config.dir=$CONFIG_DIR -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.library.path=. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
+export JVM_ARGS="$CLUSTER_PROPS -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=$CONFIG_DIR -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Djava.library.path=."
+#export JVM_ARGS="-Xmx512M -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Dhornetq.config.dir=$CONFIG_DIR -Djava.library.path=. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
for i in `ls $HORNETQ_HOME/lib/*.jar`; do
CLASSPATH=$i:$CLASSPATH
Modified: trunk/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- trunk/src/config/common/schema/hornetq-configuration.xsd 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/config/common/schema/hornetq-configuration.xsd 2009-10-06 09:31:00 UTC (rev 8051)
@@ -35,6 +35,8 @@
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="management-cluster-password" type="xsd:string">
</xsd:element>
+ <xsd:element maxOccurs="1" minOccurs="0" name="log-delegate-factory-class-name" type="xsd:string">
+ </xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="management-request-timeout" type="xsd:long">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="jmx-management-enabled" type="xsd:boolean">
Modified: trunk/src/config/jboss-as/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as/clustered/hornetq-configuration.xml 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/config/jboss-as/clustered/hornetq-configuration.xml 2009-10-06 09:31:00 UTC (rev 8051)
@@ -3,6 +3,8 @@
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
<clustered>true</clustered>
+
+ <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
<bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
Modified: trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml 2009-10-06 09:31:00 UTC (rev 8051)
@@ -2,6 +2,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+ <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
+
<bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
<journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>
Modified: trunk/src/main/org/hornetq/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/Configuration.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/core/config/Configuration.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -169,6 +169,10 @@
void setPersistIDCache(boolean persist);
+ String getLogDelegateFactoryClassName();
+
+ void setLogDelegateFactoryClassName(String className);
+
// Journal related attributes ------------------------------------------------------------
String getBindingsDirectory();
Modified: trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -29,6 +29,7 @@
import org.hornetq.core.config.cluster.DiscoveryGroupConfiguration;
import org.hornetq.core.config.cluster.DivertConfiguration;
import org.hornetq.core.config.cluster.QueueConfiguration;
+import org.hornetq.core.logging.impl.JULLogDelegateFactory;
import org.hornetq.core.server.JournalType;
import org.hornetq.utils.SimpleString;
@@ -161,6 +162,8 @@
public static final int DEFAULT_MEMORY_WARNING_THRESHOLD = 25;
public static final long DEFAULT_MEMORY_MEASURE_INTERVAL = 3000; // in milliseconds
+
+ public static final String DEFAULT_LOG_DELEGATE_FACTORY_CLASS_NAME = JULLogDelegateFactory.class.getCanonicalName();
// Attributes -----------------------------------------------------------------------------
@@ -199,6 +202,8 @@
protected int idCacheSize = DEFAULT_ID_CACHE_SIZE;
protected boolean persistIDCache = DEFAULT_PERSIST_ID_CACHE;
+
+ protected String logDelegateFactoryClassName = DEFAULT_LOG_DELEGATE_FACTORY_CLASS_NAME;
protected List<String> interceptorClassNames = new ArrayList<String>();
@@ -1080,4 +1085,14 @@
{
this.memoryMeasureInterval = memoryMeasureInterval;
}
+
+ public String getLogDelegateFactoryClassName()
+ {
+ return logDelegateFactoryClassName;
+ }
+
+ public void setLogDelegateFactoryClassName(String className)
+ {
+ this.logDelegateFactoryClassName = className;
+ }
}
Modified: trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -152,6 +152,8 @@
managementClusterUser = getString(e, "management-cluster-user", managementClusterUser, NOT_NULL_OR_EMPTY);
managementRequestTimeout = getLong(e, "management-request-timeout", managementRequestTimeout, GT_ZERO);
+
+ logDelegateFactoryClassName = getString(e, "log-delegate-factory-class-name", logDelegateFactoryClassName, NOT_NULL_OR_EMPTY);
NodeList interceptorNodes = e.getElementsByTagName("remoting-interceptors");
Added: trunk/src/main/org/hornetq/core/logging/LogDelegate.java
===================================================================
--- trunk/src/main/org/hornetq/core/logging/LogDelegate.java (rev 0)
+++ trunk/src/main/org/hornetq/core/logging/LogDelegate.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.core.logging;
+
+/**
+ * I represent operations that are delegated to underlying logging frameworks.
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public interface LogDelegate
+{
+ boolean isInfoEnabled();
+
+ boolean isDebugEnabled();
+
+ boolean isTraceEnabled();
+
+ void fatal(Object message);
+
+ void fatal(Object message, Throwable t);
+
+ void error(Object message);
+
+ void error(Object message, Throwable t);
+
+ void warn(Object message);
+
+ void warn(Object message, Throwable t);
+
+ void info(Object message);
+
+ void info(Object message, Throwable t);
+
+ void debug(Object message);
+
+ void debug(Object message, Throwable t);
+
+ void trace(Object message);
+
+ void trace(Object message, Throwable t);
+}
\ No newline at end of file
Added: trunk/src/main/org/hornetq/core/logging/LogDelegateFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/logging/LogDelegateFactory.java (rev 0)
+++ trunk/src/main/org/hornetq/core/logging/LogDelegateFactory.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.core.logging;
+
+/**
+ * I am responsible for creating {@link LogDelegate} instances.
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public interface LogDelegateFactory
+{
+ LogDelegate createDelegate(Class<?> clazz);
+}
Modified: trunk/src/main/org/hornetq/core/logging/Logger.java
===================================================================
--- trunk/src/main/org/hornetq/core/logging/Logger.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/core/logging/Logger.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -9,20 +9,19 @@
* 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.
- */
+ */
package org.hornetq.core.logging;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import java.util.logging.Level;
+import org.hornetq.core.logging.impl.JULLogDelegateFactory;
+
/**
*
* A Logger
*
- * For now just delegates to org.jboss.util.Logger
- *
* This class allows us to isolate all our logging dependencies in one place
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -30,108 +29,173 @@
*/
public class Logger
{
+ public static final String LOGGER_DELEGATE_FACTORY_CLASS_NAME = "org.hornetq.logger-delegate-factory-class-name";
+
+ private static LogDelegateFactory delegateFactory;
+
private static final ConcurrentMap<Class<?>, Logger> loggers = new ConcurrentHashMap<Class<?>, Logger>();
+
+ static
+ {
+ initialise();
+ }
+
+ public static void setDelegateFactory(final LogDelegateFactory delegateFactory)
+ {
+ clear();
+
+ Logger.delegateFactory = delegateFactory;
+ }
+ private static void clear()
+ {
+ loggers.clear();
+ }
+
+ public static void reset()
+ {
+ clear();
+
+ initialise();
+ }
+
+ public static void initialise()
+ {
+ LogDelegateFactory delegateFactory;
+
+ // If a system property is specified then this overrides any delegate factory which is set
+ // programmatically - this is primarily of use so we can configure the logger delegate on the client side
+ String className = System.getProperty(LOGGER_DELEGATE_FACTORY_CLASS_NAME);
+
+ if (className != null)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Class<?> clz = loader.loadClass(className);
+ delegateFactory = (LogDelegateFactory)clz.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Error instantiating transformer class \"" + className + "\"", e);
+ }
+ }
+ else
+ {
+ delegateFactory = new JULLogDelegateFactory();
+ }
+
+ Logger.delegateFactory = delegateFactory;
+
+ loggers.clear();
+ }
+
public static Logger getLogger(final Class<?> clazz)
{
Logger logger = loggers.get(clazz);
-
+
if (logger == null)
{
- logger = new Logger(clazz);
-
+ LogDelegate delegate = delegateFactory.createDelegate(clazz);
+
+ logger = new Logger(delegate);
+
Logger oldLogger = loggers.putIfAbsent(clazz, logger);
-
+
if (oldLogger != null)
{
logger = oldLogger;
}
- }
-
+ }
+
return logger;
}
+
+ private final LogDelegate delegate;
+
+ Logger(final LogDelegate delegate)
+ {
+ this.delegate = delegate;
+ }
- private final java.util.logging.Logger logger;
-
- private Logger(final Class<?> clazz)
+ public LogDelegate getDelegate()
{
- logger = java.util.logging.Logger.getLogger(clazz.getName());
- //logger.setUseParentHandlers(false);
+ return delegate;
}
-
+
public boolean isInfoEnabled()
{
- return logger.isLoggable(Level.INFO);
+ return delegate.isInfoEnabled();
}
-
+
public boolean isDebugEnabled()
{
- return logger.isLoggable(Level.FINE);
+ return delegate.isDebugEnabled();
}
-
+
public boolean isTraceEnabled()
{
- return logger.isLoggable(Level.FINEST);
+ return delegate.isTraceEnabled();
}
-
+
public void fatal(final Object message)
{
- logger.log(Level.SEVERE, message==null?"NULL":message.toString());
+ delegate.fatal(message);
}
-
+
public void fatal(final Object message, final Throwable t)
{
- logger.log(Level.SEVERE, message==null?"NULL":message.toString(), t);
+ delegate.fatal(message, t);
}
-
+
public void error(final Object message)
{
- logger.log(Level.SEVERE, message==null?"NULL":message.toString());
+ delegate.error(message);
}
-
+
public void error(final Object message, final Throwable t)
{
- logger.log(Level.SEVERE, message==null?"NULL":message.toString(), t);
+ delegate.error(message, t);
}
-
+
public void warn(final Object message)
{
- logger.log(Level.WARNING, message==null?"NULL":message.toString());
+ delegate.warn(message);
}
-
+
public void warn(final Object message, final Throwable t)
{
- logger.log(Level.WARNING, message==null?"NULL":message.toString(), t);
+ delegate.warn(message, t);
}
-
+
public void info(final Object message)
{
- logger.log(Level.INFO, message==null?"NULL":message.toString());
+ delegate.info(message);
}
-
+
public void info(final Object message, final Throwable t)
{
- logger.log(Level.INFO, message==null?"NULL":message.toString(), t);
+ delegate.info(message, t);
}
-
+
public void debug(final Object message)
{
- logger.log(Level.FINE, message==null?"NULL":message.toString());
+ delegate.debug(message);
}
-
+
public void debug(final Object message, final Throwable t)
{
- logger.log(Level.FINE, message==null?"NULL":message.toString(), t);
+ delegate.debug(message, t);
}
-
+
public void trace(final Object message)
{
- logger.log(Level.FINEST, message==null?"NULL":message.toString());
+ delegate.trace(message);
}
-
+
public void trace(final Object message, final Throwable t)
{
- logger.log(Level.FINEST, message==null?"NULL":message.toString(), t);
+ delegate.trace(message, t);
}
-
+
}
Added: trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegate.java
===================================================================
--- trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegate.java (rev 0)
+++ trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegate.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.core.logging.impl;
+
+import java.util.logging.Level;
+
+import org.hornetq.core.logging.LogDelegate;
+
+/**
+ *
+ * A {@link LogDelegate} which delegates to java.util.logging
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ */
+public class JULLogDelegate implements LogDelegate
+{
+ private final java.util.logging.Logger logger;
+
+ JULLogDelegate(final Class<?> clazz)
+ {
+ logger = java.util.logging.Logger.getLogger(clazz.getName());
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return logger.isLoggable(Level.INFO);
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return logger.isLoggable(Level.FINE);
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return logger.isLoggable(Level.FINEST);
+ }
+
+ public void fatal(final Object message)
+ {
+ logger.log(Level.SEVERE, message==null?"NULL":message.toString());
+ }
+
+ public void fatal(final Object message, final Throwable t)
+ {
+ logger.log(Level.SEVERE, message==null?"NULL":message.toString(), t);
+ }
+
+ public void error(final Object message)
+ {
+ logger.log(Level.SEVERE, message==null?"NULL":message.toString());
+ }
+
+ public void error(final Object message, final Throwable t)
+ {
+ logger.log(Level.SEVERE, message==null?"NULL":message.toString(), t);
+ }
+
+ public void warn(final Object message)
+ {
+ logger.log(Level.WARNING, message==null?"NULL":message.toString());
+ }
+
+ public void warn(final Object message, final Throwable t)
+ {
+ logger.log(Level.WARNING, message==null?"NULL":message.toString(), t);
+ }
+
+ public void info(final Object message)
+ {
+ logger.log(Level.INFO, message==null?"NULL":message.toString());
+ }
+
+ public void info(final Object message, final Throwable t)
+ {
+ logger.log(Level.INFO, message==null?"NULL":message.toString(), t);
+ }
+
+ public void debug(final Object message)
+ {
+ logger.log(Level.FINE, message==null?"NULL":message.toString());
+ }
+
+ public void debug(final Object message, final Throwable t)
+ {
+ logger.log(Level.FINE, message==null?"NULL":message.toString(), t);
+ }
+
+ public void trace(final Object message)
+ {
+ logger.log(Level.FINEST, message==null?"NULL":message.toString());
+ }
+
+ public void trace(final Object message, final Throwable t)
+ {
+ logger.log(Level.FINEST, message==null?"NULL":message.toString(), t);
+ }
+
+}
Added: trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegateFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegateFactory.java (rev 0)
+++ trunk/src/main/org/hornetq/core/logging/impl/JULLogDelegateFactory.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.core.logging.impl;
+
+import org.hornetq.core.logging.LogDelegate;
+import org.hornetq.core.logging.LogDelegateFactory;
+
+
+/**
+ * A {@link LogDelegateFactory} which creates {@link JULLogDelegate} instances.
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public class JULLogDelegateFactory implements LogDelegateFactory
+{
+ public LogDelegate createDelegate(final Class<?> clazz)
+ {
+ return new JULLogDelegate(clazz);
+ }
+}
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -47,6 +47,7 @@
import org.hornetq.core.exception.HornetQException;
import org.hornetq.core.filter.Filter;
import org.hornetq.core.filter.impl.FilterImpl;
+import org.hornetq.core.logging.LogDelegateFactory;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.management.ManagementService;
import org.hornetq.core.management.impl.HornetQServerControlImpl;
@@ -253,6 +254,8 @@
public synchronized void start() throws Exception
{
+ initialiseLogging();
+
log.info((configuration.isBackup() ? "backup" : "live") + " server is starting..");
if (started)
@@ -410,6 +413,8 @@
nodeID = null;
log.info("HornetQ Server version " + getVersion().getFullVersion() + " stopped");
+
+ Logger.reset();
}
// HornetQServer implementation
@@ -881,7 +886,7 @@
{
return threadPool;
}
-
+
/**
* This method is protected as it may be used as a hook for creating a custom storage manager (on tests for instance)
* @return
@@ -898,8 +903,6 @@
}
}
-
-
// Private
// --------------------------------------------------------------------------------------
@@ -966,11 +969,20 @@
scheduledPool,
managementConnectorID);
- memoryManager = new MemoryManagerImpl(configuration.getMemoryWarningThreshold(), configuration.getMemoryMeasureInterval());
+ memoryManager = new MemoryManagerImpl(configuration.getMemoryWarningThreshold(),
+ configuration.getMemoryMeasureInterval());
memoryManager.start();
}
+ private void initialiseLogging()
+ {
+ LogDelegateFactory logDelegateFactory =
+ (LogDelegateFactory)instantiateInstance(configuration.getLogDelegateFactoryClassName());
+
+ Logger.setDelegateFactory(logDelegateFactory);
+ }
+
private void initialisePart2() throws Exception
{
// Create the hard-wired components
@@ -1169,7 +1181,7 @@
queues.put(queueBindingInfo.getPersistenceID(), queue);
postOffice.addBinding(binding);
-
+
managementService.registerAddress(queueBindingInfo.getAddress());
managementService.registerQueue(queue, queueBindingInfo.getAddress(), storageManager);
}
@@ -1265,7 +1277,7 @@
}
postOffice.addBinding(binding);
-
+
managementService.registerAddress(address);
managementService.registerQueue(queue, address, storageManager);
@@ -1341,21 +1353,28 @@
if (transformerClassName != null)
{
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- try
- {
- Class<?> clz = loader.loadClass(transformerClassName);
- transformer = (Transformer)clz.newInstance();
- }
- catch (Exception e)
- {
- throw new IllegalArgumentException("Error instantiating transformer class \"" + transformerClassName + "\"",
- e);
- }
+ transformer = (Transformer)instantiateInstance(transformerClassName);
}
+
return transformer;
}
+ private Object instantiateInstance(final String className)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Class<?> clz = loader.loadClass(className);
+ Object object = clz.newInstance();
+
+ return object;
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Error instantiating transformer class \"" + className + "\"", e);
+ }
+ }
+
// Inner classes
// --------------------------------------------------------------------------------
}
Deleted: trunk/src/main/org/hornetq/integration/logging/BaseLoggerHandler.java
===================================================================
--- trunk/src/main/org/hornetq/integration/logging/BaseLoggerHandler.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/integration/logging/BaseLoggerHandler.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1,56 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.
- */
-package org.hornetq.integration.logging;
-
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public abstract class BaseLoggerHandler extends Handler
-{
- public static final int SEVERE = 1000;
-
- public static final int WARNING = 900;
-
- public static final int INFO = 800;
-
- public static final int CONFIG = 700;
-
- public static final int FINE = 500;
-
- public static final int FINER = 400;
-
- public static final int FINEST = 300;
-
- public void publish(LogRecord record)
- {
- String loggerName = record.getLoggerName();
- Level level = record.getLevel();
- String message = record.getMessage();
- Throwable throwable = record.getThrown();
- publish(loggerName, level, message, throwable);
- }
-
- abstract void publish(String loggerName, Level level, String message, Throwable throwable);
-
- public void flush()
- {
- }
-
- public void close() throws SecurityException
- {
- }
-}
Deleted: trunk/src/main/org/hornetq/integration/logging/HornetQLoggerPlugin.java
===================================================================
--- trunk/src/main/org/hornetq/integration/logging/HornetQLoggerPlugin.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/integration/logging/HornetQLoggerPlugin.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1,138 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.
- */
-
-package org.hornetq.integration.logging;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.jboss.logging.LoggerPlugin;
-
-/**
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
- at SuppressWarnings("deprecation")
-public class HornetQLoggerPlugin implements LoggerPlugin
-{
- Logger logger;
-
- public void init(String s)
- {
- logger = Logger.getLogger(s);
- }
-
- public boolean isTraceEnabled()
- {
- return logger.isLoggable(Level.FINEST);
- }
-
- public void trace(Object o)
- {
- logger.log(Level.FINEST, o.toString());
- }
-
- public void trace(Object o, Throwable throwable)
- {
- logger.log(Level.FINEST, o.toString(), throwable);
- }
-
- public void trace(String s, Object o, Throwable throwable)
- {
- logger.log(Level.FINEST, s + o, throwable);
- }
-
- public boolean isDebugEnabled()
- {
- return logger.isLoggable(Level.FINE);
- }
-
- public void debug(Object o)
- {
- logger.log(Level.FINE, o.toString());
- }
-
- public void debug(Object o, Throwable throwable)
- {
- logger.log(Level.FINE, o.toString(), throwable);
- }
-
- public void debug(String s, Object o, Throwable throwable)
- {
- logger.log(Level.FINE, s + o, throwable);
- }
-
- public boolean isInfoEnabled()
- {
- return logger.isLoggable(Level.INFO);
- }
-
- public void info(Object o)
- {
- logger.log(Level.INFO, o.toString());
- }
-
- public void info(Object o, Throwable throwable)
- {
- logger.log(Level.INFO, o.toString(), throwable);
- }
-
- public void info(String s, Object o, Throwable throwable)
- {
- logger.log(Level.INFO, s + o, throwable);
- }
-
- public void warn(Object o)
- {
- logger.log(Level.WARNING, o.toString());
- }
-
- public void warn(Object o, Throwable throwable)
- {
- logger.log(Level.WARNING, o.toString(), throwable);
- }
-
- public void warn(String s, Object o, Throwable throwable)
- {
- logger.log(Level.WARNING, s + o, throwable);
- }
-
- public void error(Object o)
- {
- logger.log(Level.SEVERE, o.toString());
- }
-
- public void error(Object o, Throwable throwable)
- {
- logger.log(Level.SEVERE, o.toString(), throwable);
- }
-
- public void error(String s, Object o, Throwable throwable)
- {
- logger.log(Level.SEVERE, s + o, throwable);
- }
-
- public void fatal(Object o)
- {
- logger.log(Level.SEVERE, o.toString());
- }
-
- public void fatal(Object o, Throwable throwable)
- {
- logger.log(Level.SEVERE, o.toString(), throwable);
- }
-
- public void fatal(String s, Object o, Throwable throwable)
- {
- logger.log(Level.SEVERE, s + o, throwable);
- }
-}
Added: trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegate.java
===================================================================
--- trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegate.java (rev 0)
+++ trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegate.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.integration.logging;
+
+import org.hornetq.core.logging.LogDelegate;
+
+/**
+ *
+ * A {@link LogDelegate} which delegates to Apache Log4j
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ */
+public class Log4jLogDelegate implements LogDelegate
+{
+ private final org.apache.log4j.Logger logger;
+
+ Log4jLogDelegate(final Class<?> clazz)
+ {
+ logger = org.apache.log4j.Logger.getLogger(clazz);
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return logger.isInfoEnabled();
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return logger.isDebugEnabled();
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return logger.isTraceEnabled();
+ }
+
+ public void fatal(final Object message)
+ {
+ logger.fatal(message);
+ }
+
+ public void fatal(final Object message, final Throwable t)
+ {
+ logger.fatal(message, t);
+ }
+
+ public void error(final Object message)
+ {
+ logger.error(message);
+ }
+
+ public void error(final Object message, final Throwable t)
+ {
+ logger.error(message, t);
+ }
+
+ public void warn(final Object message)
+ {
+ logger.warn(message);
+ }
+
+ public void warn(final Object message, final Throwable t)
+ {
+ logger.warn(message, t);
+ }
+
+ public void info(final Object message)
+ {
+ logger.info(message);
+ }
+
+ public void info(final Object message, final Throwable t)
+ {
+ logger.info(message, t);
+ }
+
+ public void debug(final Object message)
+ {
+ logger.debug(message);
+ }
+
+ public void debug(final Object message, final Throwable t)
+ {
+ logger.debug(message, t);
+ }
+
+ public void trace(final Object message)
+ {
+ logger.trace(message);
+ }
+
+ public void trace(final Object message, final Throwable t)
+ {
+ logger.trace(message, t);
+ }
+
+}
Added: trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegateFactory.java
===================================================================
--- trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegateFactory.java (rev 0)
+++ trunk/src/main/org/hornetq/integration/logging/Log4jLogDelegateFactory.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.integration.logging;
+
+import org.hornetq.core.logging.LogDelegate;
+import org.hornetq.core.logging.LogDelegateFactory;
+
+/**
+ * A {@link LogDelegateFactory} which creates {@link Log4jLogDelegate} instances.
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public class Log4jLogDelegateFactory implements LogDelegateFactory
+{
+ /* (non-Javadoc)
+ * @see org.hornetq.core.logging.LogDelegateFactory#getLogDelegate(java.lang.Class)
+ */
+ public LogDelegate createDelegate(Class<?> clazz)
+ {
+ return new Log4jLogDelegate(clazz);
+ }
+
+}
Deleted: trunk/src/main/org/hornetq/integration/logging/Log4jLoggerHandler.java
===================================================================
--- trunk/src/main/org/hornetq/integration/logging/Log4jLoggerHandler.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/src/main/org/hornetq/integration/logging/Log4jLoggerHandler.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -1,120 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.
- */
-package org.hornetq.integration.logging;
-
-import java.util.logging.Level;
-
-import org.apache.log4j.Logger;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class Log4jLoggerHandler extends BaseLoggerHandler
-{
- void publish(String loggerName, Level level, String message, Throwable throwable)
- {
- if (throwable == null)
- {
- switch (level.intValue())
- {
- case SEVERE:
- {
- Logger.getLogger(loggerName).error(message);
- break;
- }
- case WARNING:
- {
- Logger.getLogger(loggerName).warn(message);
- break;
- }
- case INFO:
- {
- Logger.getLogger(loggerName).info(message);
- break;
- }
- case CONFIG:
- {
- Logger.getLogger(loggerName).info(message);
- break;
- }
- case FINE:
- {
- Logger.getLogger(loggerName).debug(message);
- break;
- }
- case FINER:
- {
- Logger.getLogger(loggerName).debug(message);
- break;
- }
- case FINEST:
- {
- Logger.getLogger(loggerName).trace(message);
- break;
- }
- }
- }
- else
- {
- switch (level.intValue())
- {
- case SEVERE:
- {
- Logger.getLogger(loggerName).error(message, throwable);
- break;
- }
- case WARNING:
- {
- Logger.getLogger(loggerName).warn(message, throwable);
- break;
- }
- case INFO:
- {
- Logger.getLogger(loggerName).info(message, throwable);
- break;
- }
- case CONFIG:
- {
- Logger.getLogger(loggerName).info(message, throwable);
- break;
- }
- case FINE:
- {
- Logger.getLogger(loggerName).debug(message, throwable);
- break;
- }
- case FINER:
- {
- Logger.getLogger(loggerName).debug(message, throwable);
- break;
- }
- case FINEST:
- {
- Logger.getLogger(loggerName).trace(message, throwable);
- break;
- }
- }
- }
- }
-
- public void flush()
- {
- //no op
- }
-
- public void close() throws SecurityException
- {
- //no op
- }
-}
-
Modified: trunk/tests/config/ConfigurationTest-full-config.xml
===================================================================
--- trunk/tests/config/ConfigurationTest-full-config.xml 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/tests/config/ConfigurationTest-full-config.xml 2009-10-06 09:31:00 UTC (rev 8051)
@@ -16,6 +16,7 @@
<management-cluster-user>Frog</management-cluster-user>
<management-cluster-password>Wombat</management-cluster-password>
<jmx-management-enabled>false</jmx-management-enabled>
+ <log-delegate-factory-class-name>ocelot</log-delegate-factory-class-name>
<message-counter-enabled>true</message-counter-enabled>
<message-counter-max-day-history>5</message-counter-max-day-history>
<message-counter-sample-period>123456</message-counter-sample-period>
Added: trunk/tests/src/org/hornetq/tests/integration/logging/LogDelegateTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/logging/LogDelegateTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/logging/LogDelegateTest.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.tests.integration.logging;
+
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.logging.LogDelegate;
+import org.hornetq.core.logging.LogDelegateFactory;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.logging.impl.JULLogDelegate;
+import org.hornetq.core.logging.impl.JULLogDelegateFactory;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.integration.logging.Log4jLogDelegate;
+import org.hornetq.integration.logging.Log4jLogDelegateFactory;
+import org.hornetq.tests.util.ServiceTestBase;
+
+/**
+ * A LogDelegateTest
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class LogDelegateTest extends ServiceTestBase
+{
+ public void testConfigureJULViaConfiguration() throws Exception
+ {
+ Configuration config = new ConfigurationImpl();
+
+ String className = JULLogDelegateFactory.class.getCanonicalName();
+
+ config.setLogDelegateFactoryClassName(className);
+
+ HornetQServer server = super.createServer(false, config);
+
+ server.start();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof JULLogDelegate);
+
+ server.stop();
+ }
+
+ public void testConfigureLog4jViaConfiguration() throws Exception
+ {
+ Configuration config = new ConfigurationImpl();
+
+ String className = Log4jLogDelegateFactory.class.getCanonicalName();
+
+ config.setLogDelegateFactoryClassName(className);
+
+ HornetQServer server = super.createServer(false, config);
+
+ server.start();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof Log4jLogDelegate);
+
+ server.stop();
+ }
+
+ public void testConfigureLog4jViaSystemProperty() throws Exception
+ {
+ System.setProperty(Logger.LOGGER_DELEGATE_FACTORY_CLASS_NAME, Log4jLogDelegateFactory.class.getCanonicalName());
+
+ Logger.reset();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof Log4jLogDelegate);
+ }
+
+ public void testConfigureJULViaSystemProperty() throws Exception
+ {
+ System.setProperty(Logger.LOGGER_DELEGATE_FACTORY_CLASS_NAME, JULLogDelegateFactory.class.getCanonicalName());
+
+ Logger.reset();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof JULLogDelegate);
+ }
+
+ public void testDefault() throws Exception
+ {
+ Logger.reset();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof JULLogDelegate);
+ }
+
+ public void testDefaultWithConfiguration() throws Exception
+ {
+ Configuration config = new ConfigurationImpl();
+
+ HornetQServer server = super.createServer(false, config);
+
+ server.start();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof JULLogDelegate);
+
+ server.stop();
+ }
+
+ public void testUserDefinedLogger() throws Exception
+ {
+ Configuration config = new ConfigurationImpl();
+
+ String className = MyLogDelegateFactory.class.getCanonicalName();
+
+ config.setLogDelegateFactoryClassName(className);
+
+ HornetQServer server = super.createServer(false, config);
+
+ server.start();
+
+ Logger logger = Logger.getLogger(this.getClass());
+
+ assertTrue(logger.getDelegate() instanceof MyLogDelegateFactory.MyLogDelegate);
+
+ server.stop();
+ }
+
+
+
+
+}
Added: trunk/tests/src/org/hornetq/tests/integration/logging/MyLogDelegateFactory.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/logging/MyLogDelegateFactory.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/logging/MyLogDelegateFactory.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.tests.integration.logging;
+
+import org.hornetq.core.logging.LogDelegate;
+import org.hornetq.core.logging.LogDelegateFactory;
+
+/**
+ * A MyLogDelegateFactory
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class MyLogDelegateFactory implements LogDelegateFactory
+{
+ public LogDelegate createDelegate(Class<?> clazz)
+ {
+ return new MyLogDelegate();
+ }
+
+ public class MyLogDelegate implements LogDelegate
+ {
+ public void debug(Object message, Throwable t)
+ {
+ }
+
+ public void debug(Object message)
+ {
+ }
+
+ public void error(Object message, Throwable t)
+ {
+ }
+
+ public void error(Object message)
+ {
+ }
+
+ public void fatal(Object message, Throwable t)
+ {
+ }
+
+ public void fatal(Object message)
+ {
+ }
+
+ public void info(Object message, Throwable t)
+ {
+ }
+
+ public void info(Object message)
+ {
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return false;
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return false;
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return false;
+ }
+
+ public void trace(Object message, Throwable t)
+ {
+ }
+
+ public void trace(Object message)
+ {
+ }
+
+ public void warn(Object message, Throwable t)
+ {
+ }
+
+ public void warn(Object message)
+ {
+ }
+
+ }
+}
+
+
Modified: trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -49,6 +49,7 @@
assertEquals(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, conf.getScheduledThreadPoolMaxSize());
assertEquals(ConfigurationImpl.DEFAULT_SECURITY_INVALIDATION_INTERVAL, conf.getSecurityInvalidationInterval());
assertEquals(ConfigurationImpl.DEFAULT_SECURITY_ENABLED, conf.isSecurityEnabled());
+ assertEquals(ConfigurationImpl.DEFAULT_LOG_DELEGATE_FACTORY_CLASS_NAME, conf.getLogDelegateFactoryClassName());
assertEquals(ConfigurationImpl.DEFAULT_BINDINGS_DIRECTORY, conf.getBindingsDirectory());
assertEquals(ConfigurationImpl.DEFAULT_CREATE_BINDINGS_DIR, conf.isCreateBindingsDir());
assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_DIR, conf.getJournalDirectory());
Modified: trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2009-10-06 09:06:28 UTC (rev 8050)
+++ trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2009-10-06 09:31:00 UTC (rev 8051)
@@ -56,6 +56,7 @@
assertEquals(98765, conf.getTransactionTimeout());
assertEquals(56789, conf.getTransactionTimeoutScanPeriod());
assertEquals(10111213, conf.getMessageExpiryScanPeriod());
+ assertEquals("ocelot", conf.getLogDelegateFactoryClassName());
assertEquals(8, conf.getMessageExpiryThreadPriority());
assertEquals(127, conf.getIDCacheSize());
assertEquals(true, conf.isPersistIDCache());
More information about the hornetq-commits
mailing list