[jboss-svn-commits] JBL Code SVN: r30123 - in labs/jbosstm/trunk/atsintegration: classes/com/arjuna/ats/internal/jbossatx and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 12 05:32:49 EST 2009
Author: jhalliday
Date: 2009-11-12 05:32:49 -0500 (Thu, 12 Nov 2009)
New Revision: 30123
Added:
labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/internal/jbossatx/logging/
labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/internal/jbossatx/logging/JBossLogFactory.java
labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/internal/jbossatx/logging/JBossLogger.java
Modified:
labs/jbosstm/trunk/atsintegration/build.xml
Log:
Added code for integration of JBoss log manager with CLF. JBTM-595
Modified: labs/jbosstm/trunk/atsintegration/build.xml
===================================================================
--- labs/jbosstm/trunk/atsintegration/build.xml 2009-11-12 10:11:31 UTC (rev 30122)
+++ labs/jbosstm/trunk/atsintegration/build.xml 2009-11-12 10:32:49 UTC (rev 30123)
@@ -63,7 +63,9 @@
<compile.macro excluded.classes="${exclude-these-classes}">
<additional.classpath>
- <!-- jboss-integration.jar has the transactions SPI jbosssx has security -->
+ <!-- jboss-logmanager.jar for linking the CLF integration code. -->
+ <fileset dir="${env.JBOSS_HOME}/lib" includes="jboss-logmanager.jar"/>
+ <!-- jboss-integration.jar has the transactions SPI jbosssx has security (needed for recovery module only) -->
<fileset dir="${env.JBOSS_HOME}/common/lib" includes="jboss-integration.jar jbosssx.jar"/>
</additional.classpath>
</compile.macro>
Added: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/internal/jbossatx/logging/JBossLogFactory.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/internal/jbossatx/logging/JBossLogFactory.java (rev 0)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/internal/jbossatx/logging/JBossLogFactory.java 2009-11-12 10:32:49 UTC (rev 30123)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.arjuna.ats.internal.jbossatx.logging;
+
+import com.arjuna.common.internal.util.logging.LogFactoryInterface;
+import com.arjuna.common.internal.util.logging.LogInterface;
+import com.arjuna.common.util.exceptions.LogConfigurationException;
+
+/**
+ * CLF log factory for integration with JBoss log manager.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2009-11
+ */
+public class JBossLogFactory implements LogFactoryInterface
+{
+ /**
+ * Method to return a named logger.
+ *
+ * @param name Logical name of the <code>Log</code> instance to be
+ * returned (the meaning of this name is only known to the underlying
+ * logging implementation that is being wrapped)
+ * @throws com.arjuna.common.util.exceptions.LogConfigurationException
+ * if a suitable <code>LogInterface</code>
+ * instance cannot be returned
+ */
+ @Override
+ public LogInterface getLog(String name) throws LogConfigurationException
+ {
+ return new JBossLogger(name);
+ }
+}
Added: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/internal/jbossatx/logging/JBossLogger.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/internal/jbossatx/logging/JBossLogger.java (rev 0)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/internal/jbossatx/logging/JBossLogger.java 2009-11-12 10:32:49 UTC (rev 30123)
@@ -0,0 +1,275 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.arjuna.ats.internal.jbossatx.logging;
+
+import com.arjuna.common.internal.util.logging.LogInterface;
+
+import org.jboss.logmanager.Logger;
+import org.jboss.logmanager.Level;
+
+/**
+ * CLF log impl for integration with JBoss log manager.
+ *
+ * Note that although jboss log manager supports i18n, we continue to do the
+ * i18n in the CLF and pass already processed literals to the jboss layer
+ * for consistency. The jboss layer passes these through verbatim, like jdk14 logging.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2009-11
+ */
+public final class JBossLogger implements LogInterface
+{
+ private final Logger logger;
+ private static final String FQCN = JBossLogger.class.getName();
+
+ public JBossLogger(final String categoryName)
+ {
+ logger = Logger.getLogger(categoryName);
+ }
+
+ /////////////
+
+ /**
+ * Is DEBUG logging currently enabled?
+ * <p/>
+ * Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatination)
+ * when the log level is more than DEBUG.
+ *
+ * @return True if the logger is enabled for DEBUG, false otherwise
+ */
+ @Override
+ public boolean isDebugEnabled()
+ {
+ return logger.isLoggable(Level.DEBUG);
+ }
+
+ /**
+ * Is INFO logging currently enabled?
+ * <p/>
+ * Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatination)
+ * when the log level is more than INFO.
+ *
+ * @return True if the logger is enabled for INFO, false otherwise
+ */
+ @Override
+ public boolean isInfoEnabled()
+ {
+ return logger.isLoggable(Level.INFO);
+ }
+
+ /**
+ * Is WARN logging currently enabled?
+ * <p/>
+ * Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatination)
+ * when the log level is more than WARN.
+ *
+ * @return True if the logger is enabled for WARN, false otherwise
+ */
+ @Override
+ public boolean isWarnEnabled()
+ {
+ return logger.isLoggable(Level.WARN);
+ }
+
+ /**
+ * Is ERROR logging currently enabled?
+ * <p/>
+ * Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatination)
+ * when the log level is more than ERROR.
+ *
+ * @return True if the logger is enabled for ERROR, false otherwise
+ */
+ @Override
+ public boolean isErrorEnabled()
+ {
+ return logger.isLoggable(Level.ERROR);
+ }
+
+ /**
+ * Is FATAL logging currently enabled?
+ * <p/>
+ * Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatination)
+ * when the log level is more than FATAL.
+ *
+ * @return True if the logger is enabled for FATAL, false otherwise
+ */
+ @Override
+ public boolean isFatalEnabled()
+ {
+ return logger.isLoggable(Level.FATAL);
+ }
+
+ /**
+ * Is TRACE logging currently enabled?
+ * <p/>
+ * Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatination)
+ * when the log level is more than TRACE.
+ */
+ @Override
+ public boolean isTraceEnabled()
+ {
+ return logger.isLoggable(Level.TRACE);
+ }
+
+ /**
+ * <p> Log a message with trace log level. </p>
+ *
+ * @param message log this message
+ */
+ @Override
+ public void trace(String message)
+ {
+ logger.log(FQCN, Level.TRACE, message, null);
+ }
+
+ /**
+ * <p> Log an error with trace log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ @Override
+ public void trace(String message, Throwable t)
+ {
+ logger.log(FQCN, Level.TRACE, message, t);
+ }
+
+ /**
+ * <p> Log a message with debug log level. </p>
+ *
+ * @param message log this message
+ */
+ @Override
+ public void debug(String message)
+ {
+ logger.log(FQCN, Level.DEBUG, message, null);
+ }
+
+ /**
+ * <p> Log an error with debug log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ @Override
+ public void debug(String message, Throwable t)
+ {
+ logger.log(FQCN, Level.DEBUG, message, t);
+ }
+
+ /**
+ * <p> Log a message with info log level. </p>
+ *
+ * @param message log this message
+ */
+ @Override
+ public void info(String message)
+ {
+ logger.log(FQCN, Level.INFO, message, null);
+ }
+
+ /**
+ * <p> Log an error with info log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ @Override
+ public void info(String message, Throwable t)
+ {
+ logger.log(FQCN, Level.INFO, message, t);
+ }
+
+ /**
+ * <p> Log a message with warn log level. </p>
+ *
+ * @param message log this message
+ */
+ @Override
+ public void warn(String message)
+ {
+ logger.log(FQCN, Level.WARN, message, null);
+ }
+
+ /**
+ * <p> Log an error with warn log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ @Override
+ public void warn(String message, Throwable t)
+ {
+ logger.log(FQCN, Level.WARN, message, t);
+ }
+
+ /**
+ * <p> Log a message with error log level. </p>
+ *
+ * @param message log this message
+ */
+ @Override
+ public void error(String message)
+ {
+ logger.log(FQCN, Level.ERROR, message, null);
+ }
+
+ /**
+ * <p> Log an error with error log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ @Override
+ public void error(String message, Throwable t)
+ {
+ logger.log(FQCN, Level.WARN, message, t);
+ }
+
+ /**
+ * <p> Log a message with fatal log level. </p>
+ *
+ * @param message log this message
+ */
+ @Override
+ public void fatal(String message)
+ {
+ logger.log(FQCN, Level.FATAL, message, null);
+ }
+
+ /**
+ * <p> Log an error with fatal log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ @Override
+ public void fatal(String message, Throwable t)
+ {
+ logger.log(FQCN, Level.FATAL, message, t);
+ }
+}
More information about the jboss-svn-commits
mailing list