[jboss-svn-commits] JBoss Common SVN: r3385 - in common-logging-spi/trunk: src/main/java/org/jboss/logging and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jul 22 15:21:47 EDT 2009
Author: david.lloyd at jboss.com
Date: 2009-07-22 15:21:47 -0400 (Wed, 22 Jul 2009)
New Revision: 3385
Added:
common-logging-spi/trunk/src/main/java/org/jboss/logging/AbstractLoggerPluginInstance.java
common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPlugin.java
common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPluginInstance.java
common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPlugin.java
common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPluginInstance.java
Removed:
common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPlugin.java
common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPlugin.java
Modified:
common-logging-spi/trunk/pom.xml
common-logging-spi/trunk/src/main/java/org/jboss/logging/Logger.java
common-logging-spi/trunk/src/main/java/org/jboss/logging/NullMDCProvider.java
common-logging-spi/trunk/src/main/java/org/jboss/logging/NullNDCProvider.java
Log:
Add proper localization API; add capability to cache logger instances by breaking up the LoggerPlugin interface
Modified: common-logging-spi/trunk/pom.xml
===================================================================
--- common-logging-spi/trunk/pom.xml 2009-07-22 19:21:28 UTC (rev 3384)
+++ common-logging-spi/trunk/pom.xml 2009-07-22 19:21:47 UTC (rev 3385)
@@ -1,57 +1,80 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>3</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- <version>2.1.1-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>JBoss Logging Programming Interface</name>
- <url>http://www.jboss.org</url>
- <description>The JBoss Logging Framework Programming Interface</description>
- <scm>
- <connection>scm:svn:https://svn.jboss.org/repos/common/common-logging-spi/trunk/</connection>
- </scm>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!-- The tagBase property is needed during the release process so that the maven release plugin
- will create the release tag in the appropriate location. -->
- <tagBase>https://svn.jboss.org/repos/common/common-logging-spi/tags</tagBase>
- </configuration>
- </plugin>
- <plugin>
- <groupId>jboss.maven-plugins</groupId>
- <artifactId>jboss-deploy-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshot Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>3</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>JBoss Logging Programming Interface</name>
+ <url>http://www.jboss.org</url>
+ <description>The JBoss Logging Framework Programming Interface</description>
+ <scm>
+ <connection>scm:svn:https://svn.jboss.org/repos/common/common-logging-spi/trunk/</connection>
+ </scm>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- The tagBase property is needed during the release process so that the maven release plugin
+ will create the release tag in the appropriate location. -->
+ <tagBase>https://svn.jboss.org/repos/common/common-logging-spi/tags</tagBase>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>jboss.maven-plugins</groupId>
+ <artifactId>jboss-deploy-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <splitindex>false</splitindex>
+ <doclet>net.gleamynode.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.2.5.GA</version>
+ </docletArtifact>
+ <bottom><![CDATA[<i>Copyright © 2009 JBoss, a division of Red Hat, Inc.</i>]]></bottom>
+ <verbose>true</verbose>
+ <links>
+ <link>http://java.sun.com/javase/6/docs/api/</link>
+ </links>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
</project>
\ No newline at end of file
Added: common-logging-spi/trunk/src/main/java/org/jboss/logging/AbstractLoggerPluginInstance.java
===================================================================
--- common-logging-spi/trunk/src/main/java/org/jboss/logging/AbstractLoggerPluginInstance.java (rev 0)
+++ common-logging-spi/trunk/src/main/java/org/jboss/logging/AbstractLoggerPluginInstance.java 2009-07-22 19:21:47 UTC (rev 3385)
@@ -0,0 +1,58 @@
+/*
+ * 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 org.jboss.logging;
+
+/**
+ * An abstract base class for logger plugin instances.
+ */
+public abstract class AbstractLoggerPluginInstance implements LoggerPluginInstance {
+ public void tracef(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ if (isTraceEnabled()) {
+ trace(loggerFcqn, String.format(String.valueOf(message), params), null, t);
+ }
+ }
+
+ public void debugf(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ if (isDebugEnabled()) {
+ debug(loggerFcqn, String.format(String.valueOf(message), params), null, t);
+ }
+ }
+
+ public void infof(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ if (isInfoEnabled()) {
+ info(loggerFcqn, String.format(String.valueOf(message), params), null, t);
+ }
+ }
+
+ public void warnf(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ warn(loggerFcqn, String.format(String.valueOf(message), params), null, t);
+ }
+
+ public void errorf(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ error(loggerFcqn, String.format(String.valueOf(message), params), null, t);
+ }
+
+ public void fatalf(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ fatal(loggerFcqn, String.format(String.valueOf(message), params), null, t);
+ }
+}
Modified: common-logging-spi/trunk/src/main/java/org/jboss/logging/Logger.java
===================================================================
--- common-logging-spi/trunk/src/main/java/org/jboss/logging/Logger.java 2009-07-22 19:21:28 UTC (rev 3384)
+++ common-logging-spi/trunk/src/main/java/org/jboss/logging/Logger.java 2009-07-22 19:21:47 UTC (rev 3385)
@@ -62,6 +62,8 @@
/** Serialization */
private static final long serialVersionUID = 4232175575988879434L;
+ private static final String FQCN = Logger.class.getName();
+
/** The system property to look for an externalized LoggerPlugin implementation class */
protected static String PLUGIN_CLASS_PROP = "org.jboss.logging.Logger.pluginClass";
@@ -83,7 +85,7 @@
private final String name;
/** The logger plugin delegate */
- protected transient LoggerPlugin loggerDelegate = null;
+ protected transient LoggerPluginInstance loggerDelegate = null;
/** The LoggerPlugin implementation class name in use
*
@@ -101,7 +103,7 @@
*/
public static void setPluginClassName(String pluginClassName)
{
- if (pluginClassName.equals(Logger.pluginClassName) == false)
+ if (! pluginClassName.equals(Logger.pluginClassName))
{
Logger.pluginClassName = pluginClassName;
init();
@@ -116,7 +118,7 @@
protected Logger(final String name)
{
this.name = name;
- this.loggerDelegate = getDelegatePlugin(name);
+ this.loggerDelegate = getDelegatePluginInstance(name);
}
/**
@@ -134,7 +136,7 @@
*
* @return the delegate
*/
- public LoggerPlugin getLoggerPlugin()
+ public LoggerPluginInstance getLoggerPlugin()
{
return this.loggerDelegate;
}
@@ -157,7 +159,7 @@
*/
public void trace(Object message)
{
- loggerDelegate.trace(message);
+ loggerDelegate.trace(FQCN, message, null, null);
}
/**
@@ -168,7 +170,7 @@
*/
public void trace(Object message, Throwable t)
{
- loggerDelegate.trace(message, t);
+ loggerDelegate.trace(FQCN, message, null, t);
}
/**
@@ -180,18 +182,54 @@
*/
public void trace(String loggerFqcn, Object message, Throwable t)
{
- loggerDelegate.trace(loggerFqcn, message, t);
+ loggerDelegate.trace(loggerFqcn, message, null, t);
}
+ /**
+ * Issue a log message with parameters with a level of TRACE.
+ *
+ * @param message the message
+ * @param params the message parameters
+ */
+ public void trace(Object message, Object[] params)
+ {
+ loggerDelegate.trace(FQCN, message, params, null);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of TRACE.
+ *
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void trace(Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.trace(FQCN, message, params, t);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of TRACE.
+ *
+ * @param loggerFqcn the logger class name
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void trace(String loggerFqcn, Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.trace(loggerFqcn, message, params, t);
+ }
+
/**
* Issue a formatted log message with a level of TRACE.
*
- * @param format the format string, as per {@link String#format(String, Object[])}
+ * @param format the format string as per {@link String#format(String, Object[])} or resource bundle key therefor
* @param params the parameters
*/
public void tracef(String format, Object... params)
{
- if (isTraceEnabled()) trace(String.format(format, params));
+ loggerDelegate.tracef(FQCN, format, params, null);
}
/**
@@ -203,15 +241,14 @@
*/
public void tracef(Throwable t, String format, Object... params)
{
- if (isTraceEnabled()) trace(String.format(format, params), t);
+ loggerDelegate.tracef(FQCN, format, params, t);
}
/**
* Check to see if the DEBUG level is enabled for this logger.
*
- * @deprecated DEBUG is for low volume logging, you don't need this
- * @return true if a {@link #trace(Object)} method invocation would pass
- * the msg to the configured appenders, false otherwise.
+ * @return true if a {@link #debug(Object)} method invocation would pass
+ * the msg to the configured appenders, false otherwise.
*/
public boolean isDebugEnabled()
{
@@ -219,28 +256,28 @@
}
/**
- * Issue a log msg with a level of DEBUG.
- *
+ * Issue a log message with a level of DEBUG.
+ *
* @param message the message
*/
public void debug(Object message)
{
- loggerDelegate.debug(message);
+ loggerDelegate.debug(FQCN, message, null, null);
}
/**
- * Issue a log msg and throwable with a level of DEBUG.
- *
+ * Issue a log message and throwable with a level of DEBUG.
+ *
* @param message the message
* @param t the throwable
*/
public void debug(Object message, Throwable t)
{
- loggerDelegate.debug(message, t);
+ loggerDelegate.debug(FQCN, message, null, t);
}
/**
- * Issue a log msg and throwable with a level of DEBUG and a specific logger class name.
+ * Issue a log message and throwable with a level of DEBUG and a specific logger class name.
*
* @param loggerFqcn the logger class name
* @param message the message
@@ -248,18 +285,54 @@
*/
public void debug(String loggerFqcn, Object message, Throwable t)
{
- loggerDelegate.debug(loggerFqcn, message, t);
+ loggerDelegate.debug(loggerFqcn, message, null, t);
}
+ /**
+ * Issue a log message with parameters with a level of DEBUG.
+ *
+ * @param message the message
+ * @param params the message parameters
+ */
+ public void debug(Object message, Object[] params)
+ {
+ loggerDelegate.debug(FQCN, message, params, null);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of DEBUG.
+ *
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void debug(Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.debug(FQCN, message, params, t);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of DEBUG.
+ *
+ * @param loggerFqcn the logger class name
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void debug(String loggerFqcn, Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.debug(loggerFqcn, message, params, t);
+ }
+
/**
* Issue a formatted log message with a level of DEBUG.
*
- * @param format the format string, as per {@link String#format(String, Object[])}
+ * @param format the format string as per {@link String#format(String, Object[])} or resource bundle key therefor
* @param params the parameters
*/
public void debugf(String format, Object... params)
{
- if (isDebugEnabled()) debug(String.format(format, params));
+ loggerDelegate.debugf(FQCN, format, params, null);
}
/**
@@ -271,15 +344,14 @@
*/
public void debugf(Throwable t, String format, Object... params)
{
- if (isDebugEnabled()) debug(String.format(format, params), t);
+ loggerDelegate.debugf(FQCN, format, params, t);
}
/**
* Check to see if the INFO level is enabled for this logger.
*
- * @deprecated INFO is for low volume information, you don't need this
* @return true if a {@link #info(Object)} method invocation would pass
- * the msg to the configured appenders, false otherwise.
+ * the msg to the configured appenders, false otherwise.
*/
public boolean isInfoEnabled()
{
@@ -287,28 +359,28 @@
}
/**
- * Issue a log msg with a level of INFO.
- *
+ * Issue a log message with a level of INFO.
+ *
* @param message the message
*/
public void info(Object message)
{
- loggerDelegate.info(message);
+ loggerDelegate.info(FQCN, message, null, null);
}
/**
- * Issue a log msg and throwable with a level of INFO.
- *
+ * Issue a log message and throwable with a level of INFO.
+ *
* @param message the message
* @param t the throwable
*/
public void info(Object message, Throwable t)
{
- loggerDelegate.info(message, t);
+ loggerDelegate.info(FQCN, message, null, t);
}
/**
- * Issue a log msg and throwable with a level of INFO and a specific logger class name.
+ * Issue a log message and throwable with a level of INFO and a specific logger class name.
*
* @param loggerFqcn the logger class name
* @param message the message
@@ -316,18 +388,54 @@
*/
public void info(String loggerFqcn, Object message, Throwable t)
{
- loggerDelegate.info(loggerFqcn, message, t);
+ loggerDelegate.info(loggerFqcn, message, null, t);
}
+ /**
+ * Issue a log message with parameters with a level of INFO.
+ *
+ * @param message the message
+ * @param params the message parameters
+ */
+ public void info(Object message, Object[] params)
+ {
+ loggerDelegate.info(FQCN, message, params, null);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of INFO.
+ *
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void info(Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.info(FQCN, message, params, t);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of INFO.
+ *
+ * @param loggerFqcn the logger class name
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void info(String loggerFqcn, Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.info(loggerFqcn, message, params, t);
+ }
+
/**
* Issue a formatted log message with a level of INFO.
*
- * @param format the format string, as per {@link String#format(String, Object[])}
+ * @param format the format string as per {@link String#format(String, Object[])} or resource bundle key therefor
* @param params the parameters
*/
public void infof(String format, Object... params)
{
- if (isInfoEnabled()) info(String.format(format, params));
+ loggerDelegate.infof(FQCN, format, params, null);
}
/**
@@ -339,32 +447,32 @@
*/
public void infof(Throwable t, String format, Object... params)
{
- if (isInfoEnabled()) info(String.format(format, params), t);
+ loggerDelegate.infof(FQCN, format, params, t);
}
/**
- * Issue a log msg with a level of WARN.
- *
+ * Issue a log message with a level of WARN.
+ *
* @param message the message
*/
public void warn(Object message)
{
- loggerDelegate.warn(message);
+ loggerDelegate.warn(FQCN, message, null, null);
}
/**
- * Issue a log msg and throwable with a level of WARN.
- *
+ * Issue a log message and throwable with a level of WARN.
+ *
* @param message the message
* @param t the throwable
*/
public void warn(Object message, Throwable t)
{
- loggerDelegate.warn(message, t);
+ loggerDelegate.warn(FQCN, message, null, t);
}
/**
- * Issue a log msg and throwable with a level of WARN and a specific logger class name.
+ * Issue a log message and throwable with a level of WARN and a specific logger class name.
*
* @param loggerFqcn the logger class name
* @param message the message
@@ -372,18 +480,54 @@
*/
public void warn(String loggerFqcn, Object message, Throwable t)
{
- loggerDelegate.warn(loggerFqcn, message, t);
+ loggerDelegate.warn(loggerFqcn, message, null, t);
}
+ /**
+ * Issue a log message with parameters with a level of WARN.
+ *
+ * @param message the message
+ * @param params the message parameters
+ */
+ public void warn(Object message, Object[] params)
+ {
+ loggerDelegate.warn(FQCN, message, params, null);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of WARN.
+ *
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void warn(Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.warn(FQCN, message, params, t);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of WARN.
+ *
+ * @param loggerFqcn the logger class name
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void warn(String loggerFqcn, Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.warn(loggerFqcn, message, params, t);
+ }
+
/**
* Issue a formatted log message with a level of WARN.
*
- * @param format the format string, as per {@link String#format(String, Object[])}
+ * @param format the format string as per {@link String#format(String, Object[])} or resource bundle key therefor
* @param params the parameters
*/
public void warnf(String format, Object... params)
{
- warn(String.format(format, params));
+ loggerDelegate.warnf(FQCN, format, params, null);
}
/**
@@ -395,32 +539,32 @@
*/
public void warnf(Throwable t, String format, Object... params)
{
- warn(String.format(format, params), t);
+ loggerDelegate.warnf(FQCN, format, params, t);
}
/**
- * Issue a log msg with a level of ERROR.
- *
+ * Issue a log message with a level of ERROR.
+ *
* @param message the message
*/
public void error(Object message)
{
- loggerDelegate.error(message);
+ loggerDelegate.error(FQCN, message, null, null);
}
/**
- * Issue a log msg and throwable with a level of ERROR.
- *
+ * Issue a log message and throwable with a level of ERROR.
+ *
* @param message the message
* @param t the throwable
*/
public void error(Object message, Throwable t)
{
- loggerDelegate.error(message, t);
+ loggerDelegate.error(FQCN, message, null, t);
}
/**
- * Issue a log msg and throwable with a level of ERROR and a specific logger class name.
+ * Issue a log message and throwable with a level of ERROR and a specific logger class name.
*
* @param loggerFqcn the logger class name
* @param message the message
@@ -428,18 +572,54 @@
*/
public void error(String loggerFqcn, Object message, Throwable t)
{
- loggerDelegate.error(loggerFqcn, message, t);
+ loggerDelegate.error(loggerFqcn, message, null, t);
}
+ /**
+ * Issue a log message with parameters with a level of ERROR.
+ *
+ * @param message the message
+ * @param params the message parameters
+ */
+ public void error(Object message, Object[] params)
+ {
+ loggerDelegate.error(FQCN, message, params, null);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of ERROR.
+ *
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void error(Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.error(FQCN, message, params, t);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of ERROR.
+ *
+ * @param loggerFqcn the logger class name
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void error(String loggerFqcn, Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.error(loggerFqcn, message, params, t);
+ }
+
/**
* Issue a formatted log message with a level of ERROR.
*
- * @param format the format string, as per {@link String#format(String, Object[])}
+ * @param format the format string as per {@link String#format(String, Object[])} or resource bundle key therefor
* @param params the parameters
*/
public void errorf(String format, Object... params)
{
- error(String.format(format, params));
+ loggerDelegate.errorf(FQCN, format, params, null);
}
/**
@@ -451,32 +631,32 @@
*/
public void errorf(Throwable t, String format, Object... params)
{
- error(String.format(format, params), t);
+ loggerDelegate.errorf(FQCN, format, params, t);
}
/**
- * Issue a log msg with a level of FATAL.
- *
+ * Issue a log message with a level of FATAL.
+ *
* @param message the message
*/
public void fatal(Object message)
{
- loggerDelegate.fatal(message);
+ loggerDelegate.fatal(FQCN, message, null, null);
}
/**
- * Issue a log msg and throwable with a level of FATAL.
- *
+ * Issue a log message and throwable with a level of FATAL.
+ *
* @param message the message
* @param t the throwable
*/
public void fatal(Object message, Throwable t)
{
- loggerDelegate.fatal(message, t);
+ loggerDelegate.fatal(FQCN, message, null, t);
}
/**
- * Issue a log msg and throwable with a level of FATAL and a specific logger class name.
+ * Issue a log message and throwable with a level of FATAL and a specific logger class name.
*
* @param loggerFqcn the logger class name
* @param message the message
@@ -484,18 +664,54 @@
*/
public void fatal(String loggerFqcn, Object message, Throwable t)
{
- loggerDelegate.fatal(loggerFqcn, message, t);
+ loggerDelegate.fatal(loggerFqcn, message, null, t);
}
+ /**
+ * Issue a log message with parameters with a level of FATAL.
+ *
+ * @param message the message
+ * @param params the message parameters
+ */
+ public void fatal(Object message, Object[] params)
+ {
+ loggerDelegate.fatal(FQCN, message, params, null);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of FATAL.
+ *
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void fatal(Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.fatal(FQCN, message, params, t);
+ }
+
+ /**
+ * Issue a log message with parameters and a throwable with a level of FATAL.
+ *
+ * @param loggerFqcn the logger class name
+ * @param message the message
+ * @param params the message parameters
+ * @param t the throwable
+ */
+ public void fatal(String loggerFqcn, Object message, Object[] params, Throwable t)
+ {
+ loggerDelegate.fatal(loggerFqcn, message, params, t);
+ }
+
/**
* Issue a formatted log message with a level of FATAL.
*
- * @param format the format string, as per {@link String#format(String, Object[])}
+ * @param format the format string as per {@link String#format(String, Object[])} or resource bundle key therefor
* @param params the parameters
*/
public void fatalf(String format, Object... params)
{
- fatal(String.format(format, params));
+ loggerDelegate.fatalf(FQCN, format, params, null);
}
/**
@@ -507,9 +723,10 @@
*/
public void fatalf(Throwable t, String format, Object... params)
{
- fatal(String.format(format, params), t);
+ loggerDelegate.fatalf(FQCN, format, params, t);
}
+
/**
* Custom serialization to reinitalize the delegate
*
@@ -527,7 +744,7 @@
{
init();
}
- this.loggerDelegate = getDelegatePlugin(name);
+ this.loggerDelegate = getDelegatePluginInstance(name);
}
/**
@@ -587,9 +804,10 @@
* @param name the name of the logger
* @return the plugin
*/
- protected static LoggerPlugin getDelegatePlugin(String name)
+ protected static LoggerPluginInstance getDelegatePluginInstance(String name)
{
- LoggerPlugin plugin = null;
+ LoggerPlugin plugin;
+ LoggerPluginInstance instance;
try
{
plugin = (LoggerPlugin) pluginClass.newInstance();
@@ -600,17 +818,17 @@
}
try
{
- plugin.init(name);
+ instance = plugin.getInstance(name);
}
catch (Throwable e)
{
String extraInfo = e.getMessage();
System.err.println("Failed to initalize plugin: " + plugin
+ (extraInfo != null ? ", cause: " + extraInfo : ""));
- plugin = new NullLoggerPlugin();
+ instance = new NullLoggerPluginInstance();
}
- return plugin;
+ return instance;
}
/**
@@ -638,7 +856,7 @@
catch (Throwable e)
{
// The plugin could not be setup, default to a null logger
- pluginClass = org.jboss.logging.NullLoggerPlugin.class;
+ pluginClass = NullLoggerPluginInstance.class;
}
}
}
Deleted: common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPlugin.java
===================================================================
--- common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPlugin.java 2009-07-22 19:21:28 UTC (rev 3384)
+++ common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPlugin.java 2009-07-22 19:21:47 UTC (rev 3385)
@@ -1,212 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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 org.jboss.logging;
-
-/**
- * Defines a "pluggable" login module. In fact, this is only used to split between
- * log4j and /dev/null. Choice is made in org.jboss.logging.Logger
- *
- * @see org.jboss.logging.Logger
- * @see org.jboss.logging.NullLoggerPlugin
- *
- * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
- * @version $Revision$
- */
-public interface LoggerPlugin
-{
- /**
- * Initialise the logger with the given name
- *
- * @param name the name
- */
- void init(String name);
-
- /**
- * Check to see if the TRACE level is enabled for this logger.
- *
- * @return true if a {@link #trace(Object)} method invocation would pass
- * the msg to the configured appenders, false otherwise.
- */
- boolean isTraceEnabled();
-
- /**
- * Issue a log msg with a level of TRACE.
- *
- * @param message the message
- */
- void trace(Object message);
-
- /**
- * Issue a log msg and throwable with a level of TRACE.
- *
- * @param message the message
- * @param t the throwable
- */
- void trace(Object message, Throwable t);
-
- /**
- * Issue a log msg and throwable with a level of TRACE and a specific logger class name.
- *
- * @param loggerFcqn the logger class name
- * @param message the message
- * @param t the throwable
- */
- void trace(String loggerFcqn, Object message, Throwable t);
-
- /**
- * Check to see if the DEBUG level is enabled for this logger.
- *
- * @deprecated DEBUG is for low volume logging, you don't need this
- * @return true if a {@link #trace(Object)} method invocation would pass
- * the msg to the configured appenders, false otherwise.
- */
- boolean isDebugEnabled();
-
- /**
- * Issue a log msg with a level of DEBUG.
- *
- * @param message the message
- */
- void debug(Object message);
-
- /**
- * Issue a log msg and throwable with a level of DEBUG.
- *
- * @param message the message
- * @param t the throwable
- */
- void debug(Object message, Throwable t);
-
- /**
- * Issue a log msg and throwable with a level of DEBUG and a specific logger class name.
- *
- * @param loggerFcqn the logger class name
- * @param message the message
- * @param t the throwable
- */
- void debug(String loggerFcqn, Object message, Throwable t);
-
- /**
- * Check to see if the INFO level is enabled for this logger.
- *
- * @deprecated INFO is for low volume information, you don't need this
- * @return true if a {@link #info(Object)} method invocation would pass
- * the msg to the configured appenders, false otherwise.
- */
- boolean isInfoEnabled();
-
- /**
- * Issue a log msg with a level of INFO.
- *
- * @param message the message
- */
- void info(Object message);
-
- /**
- * Issue a log msg and throwable with a level of INFO.
- *
- * @param message the message
- * @param t the throwable
- */
- void info(Object message, Throwable t);
-
- /**
- * Issue a log msg and throwable with a level of INFO and a specific logger class name.
- *
- * @param loggerFcqn the logger class name
- * @param message the message
- * @param t the throwable
- */
- void info(String loggerFcqn, Object message, Throwable t);
-
- /**
- * Issue a log msg with a level of WARN.
- *
- * @param message the message
- */
- void warn(Object message);
-
- /**
- * Issue a log msg and throwable with a level of WARN.
- *
- * @param message the message
- * @param t the throwable
- */
- void warn(Object message, Throwable t);
-
- /**
- * Issue a log msg and throwable with a level of WARN and a specific logger class name.
- *
- * @param loggerFcqn the logger class name
- * @param message the message
- * @param t the throwable
- */
- void warn(String loggerFcqn, Object message, Throwable t);
-
- /**
- * Issue a log msg with a level of ERROR.
- *
- * @param message the message
- */
- void error(Object message);
-
- /**
- * Issue a log msg and throwable with a level of ERROR.
- *
- * @param message the message
- * @param t the throwable
- */
- void error(Object message, Throwable t);
-
- /**
- * Issue a log msg and throwable with a level of ERROR and a specific logger class name.
- *
- * @param loggerFcqn the logger class name
- * @param message the message
- * @param t the throwable
- */
- void error(String loggerFcqn, Object message, Throwable t);
-
- /**
- * Issue a log msg with a level of FATAL.
- *
- * @param message the message
- */
- void fatal(Object message);
-
- /**
- * Issue a log msg and throwable with a level of FATAL.
- *
- * @param message the message
- * @param t the throwable
- */
- void fatal(Object message, Throwable t);
-
- /**
- * Issue a log msg and throwable with a level of FATAL and a specific logger class name.
- *
- * @param loggerFcqn the logger class name
- * @param message the message
- * @param t the throwable
- */
- void fatal(String loggerFcqn, Object message, Throwable t);
-}
Added: common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPlugin.java
===================================================================
--- common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPlugin.java (rev 0)
+++ common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPlugin.java 2009-07-22 19:21:47 UTC (rev 3385)
@@ -0,0 +1,38 @@
+/*
+ * 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 org.jboss.logging;
+
+/**
+ * A factory for producing logger plugins. Implementations may implement some type of caching/reuse.
+ */
+public interface LoggerPlugin extends MDCSupport, NDCSupport
+{
+ /**
+ * Get a logger plugin instance with the given name. The returned instance may be a cached or newly
+ * created instance.
+ *
+ * @param name the logger category name
+ * @return the corresponding logger plugin instance
+ */
+ LoggerPluginInstance getInstance(String name);
+}
Copied: common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPluginInstance.java (from rev 3155, common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPlugin.java)
===================================================================
--- common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPluginInstance.java (rev 0)
+++ common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPluginInstance.java 2009-07-22 19:21:47 UTC (rev 3385)
@@ -0,0 +1,191 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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 org.jboss.logging;
+
+/**
+ * Defines a "pluggable" login module's logger implementation.
+ *
+ * @see org.jboss.logging.Logger
+ * @see NullLoggerPluginInstance
+ *
+ * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>
+ * @author David M. Lloyd
+ * @version $Revision$
+ */
+public interface LoggerPluginInstance
+{
+ /**
+ * Check to see if the TRACE level is enabled for this logger.
+ *
+ * @return true if a {@link #trace(String, Object, Object[], Throwable) trace*()} method invocation would pass
+ * the msg to the configured appenders, false otherwise.
+ */
+ boolean isTraceEnabled();
+
+ /**
+ * Issue a log msg and throwable with a level of TRACE and a specific logger class name, with the given
+ * parameters.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void trace(String loggerFcqn, Object message, Object[] params, Throwable t);
+
+ /**
+ * Issue a log msg and throwable with a level of TRACE and a specific logger class name, with the given
+ * parameters, formatting using the {@link java.util.Formatter} format methodology.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void tracef(String loggerFcqn, Object message, Object[] params, Throwable t);
+
+ /**
+ * Check to see if the DEBUG level is enabled for this logger.
+ *
+ * @return true if a {@link #debug(String, Object, Object[], Throwable) debug*()} method invocation would pass
+ * the msg to the configured appenders, false otherwise.
+ */
+ boolean isDebugEnabled();
+
+ /**
+ * Issue a log msg and throwable with a level of DEBUG and a specific logger class name, with the given
+ * parameters.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void debug(String loggerFcqn, Object message, Object[] params, Throwable t);
+
+ /**
+ * Issue a log msg and throwable with a level of DEBUG and a specific logger class name, with the given
+ * parameters, formatting using the {@link java.util.Formatter} format methodology.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void debugf(String loggerFcqn, Object message, Object[] params, Throwable t);
+
+ /**
+ * Check to see if the INFO level is enabled for this logger.
+ *
+ * @return true if a {@link #info(String, Object, Object[], Throwable) info*()} method invocation would pass
+ * the msg to the configured appenders, false otherwise.
+ */
+ boolean isInfoEnabled();
+
+ /**
+ * Issue a log msg and throwable with a level of INFO and a specific logger class name, with the given
+ * parameters.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void info(String loggerFcqn, Object message, Object[] params, Throwable t);
+
+ /**
+ * Issue a log msg and throwable with a level of INFO and a specific logger class name, with the given
+ * parameters, formatting using the {@link java.util.Formatter} format methodology.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void infof(String loggerFcqn, Object message, Object[] params, Throwable t);
+
+ /**
+ * Issue a log msg and throwable with a level of WARN and a specific logger class name, with the given
+ * parameters.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void warn(String loggerFcqn, Object message, Object[] params, Throwable t);
+
+ /**
+ * Issue a log msg and throwable with a level of WARN and a specific logger class name, with the given
+ * parameters, formatting using the {@link java.util.Formatter} format methodology.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void warnf(String loggerFcqn, Object message, Object[] params, Throwable t);
+
+ /**
+ * Issue a log msg and throwable with a level of ERROR and a specific logger class name, with the given
+ * parameters.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void error(String loggerFcqn, Object message, Object[] params, Throwable t);
+
+ /**
+ * Issue a log msg and throwable with a level of ERROR and a specific logger class name, with the given
+ * parameters, formatting using the {@link java.util.Formatter} format methodology.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void errorf(String loggerFcqn, Object message, Object[] params, Throwable t);
+
+ /**
+ * Issue a log msg and throwable with a level of FATAL and a specific logger class name, with the given
+ * parameters.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void fatal(String loggerFcqn, Object message, Object[] params, Throwable t);
+
+ /**
+ * Issue a log msg and throwable with a level of FATAL and a specific logger class name, with the given
+ * parameters, formatting using the {@link java.util.Formatter} format methodology.
+ *
+ * @param loggerFcqn the logger class name
+ * @param message the message
+ * @param params the parameters, or {@code null} for none
+ * @param t the throwable, or {@code null} for none
+ */
+ void fatalf(String loggerFcqn, Object message, Object[] params, Throwable t);
+}
Property changes on: common-logging-spi/trunk/src/main/java/org/jboss/logging/LoggerPluginInstance.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPlugin.java
===================================================================
--- common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPlugin.java 2009-07-22 19:21:28 UTC (rev 3384)
+++ common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPlugin.java 2009-07-22 19:21:47 UTC (rev 3385)
@@ -1,147 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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 org.jboss.logging;
-
-/**
- * LoggerPlugin implementation producing no output at all. Used for client
- * side logging when no log4j.jar is available on the classpath.
- *
- * @see org.jboss.logging.Logger
- * @see org.jboss.logging.LoggerPlugin
- *
- * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
- * @version $Revision$
- */
-public class NullLoggerPlugin implements LoggerPlugin
-{
- public void init(String name)
- {
- /* don't care */
- }
-
- public boolean isTraceEnabled()
- {
- return false;
- }
-
- public void trace(Object message)
- {
- // nothing
- }
-
- public void trace(Object message, Throwable t)
- {
- // nothing
- }
-
- public void trace(String loggerFcqn, Object message, Throwable t)
- {
- // nothing
- }
-
- @Deprecated
- public boolean isDebugEnabled()
- {
- return false;
- }
-
- public void debug(Object message)
- {
- // nothing
- }
-
- public void debug(Object message, Throwable t)
- {
- // nothing
- }
-
- public void debug(String loggerFcqn, Object message, Throwable t)
- {
- // nothing
- }
-
- @Deprecated
- public boolean isInfoEnabled()
- {
- return false;
- }
-
- public void info(Object message)
- {
- // nothing
- }
-
- public void info(Object message, Throwable t)
- {
- // nothing
- }
-
- public void info(String loggerFcqn, Object message, Throwable t)
- {
- // nothing
- }
-
- public void error(Object message)
- {
- // nothing
- }
-
- public void error(Object message, Throwable t)
- {
- // nothing
- }
-
- public void error(String loggerFcqn, Object message, Throwable t)
- {
- // nothing
- }
-
- public void fatal(Object message)
- {
- // nothing
- }
-
- public void fatal(Object message, Throwable t)
- {
- // nothing
- }
-
- public void fatal(String loggerFcqn, Object message, Throwable t)
- {
- // nothing
- }
-
- public void warn(Object message)
- {
- // nothing
- }
-
- public void warn(Object message, Throwable t)
- {
- // nothing
- }
-
- public void warn(String loggerFcqn, Object message, Throwable t)
- {
- // nothing
- }
-}
Added: common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPlugin.java
===================================================================
--- common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPlugin.java (rev 0)
+++ common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPlugin.java 2009-07-22 19:21:47 UTC (rev 3385)
@@ -0,0 +1,42 @@
+/*
+ * 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 org.jboss.logging;
+
+/**
+ * The null logger plugin. Always returns the same plugin instance.
+ */
+public class NullLoggerPlugin implements LoggerPlugin {
+ public static final LoggerPluginInstance INSTANCE = new NullLoggerPluginInstance();
+
+ public LoggerPluginInstance getInstance(String name) {
+ return INSTANCE;
+ }
+
+ public MDCProvider getMDCProvider() {
+ return NullMDCProvider.INSTANCE;
+ }
+
+ public NDCProvider getNDCProvider() {
+ return NullNDCProvider.INSTANCE;
+ }
+}
Copied: common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPluginInstance.java (from rev 3155, common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPlugin.java)
===================================================================
--- common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPluginInstance.java (rev 0)
+++ common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPluginInstance.java 2009-07-22 19:21:47 UTC (rev 3385)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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 org.jboss.logging;
+
+/**
+ * LoggerPlugin implementation producing no output at all. Used for client
+ * side logging when no log4j.jar is available on the classpath.
+ *
+ * @see org.jboss.logging.Logger
+ * @see LoggerPluginInstance
+ *
+ * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
+ * @author David M. Lloyd
+ * @version $Revision$
+ */
+public class NullLoggerPluginInstance extends AbstractLoggerPluginInstance
+{
+ public boolean isTraceEnabled() {
+ return false;
+ }
+
+ public void trace(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ }
+
+ public boolean isDebugEnabled() {
+ return false;
+ }
+
+ public void debug(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ }
+
+ public boolean isInfoEnabled() {
+ return false;
+ }
+
+ public void info(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ }
+
+ public void warn(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ }
+
+ public void error(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ }
+
+ public void fatal(String loggerFcqn, Object message, Object[] params, Throwable t) {
+ }
+}
Property changes on: common-logging-spi/trunk/src/main/java/org/jboss/logging/NullLoggerPluginInstance.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: common-logging-spi/trunk/src/main/java/org/jboss/logging/NullMDCProvider.java
===================================================================
--- common-logging-spi/trunk/src/main/java/org/jboss/logging/NullMDCProvider.java 2009-07-22 19:21:28 UTC (rev 3384)
+++ common-logging-spi/trunk/src/main/java/org/jboss/logging/NullMDCProvider.java 2009-07-22 19:21:47 UTC (rev 3385)
@@ -30,6 +30,8 @@
*/
public class NullMDCProvider implements MDCProvider
{
+ public static MDCProvider INSTANCE = new NullMDCProvider();
+
public Object get(String key)
{
return null;
Modified: common-logging-spi/trunk/src/main/java/org/jboss/logging/NullNDCProvider.java
===================================================================
--- common-logging-spi/trunk/src/main/java/org/jboss/logging/NullNDCProvider.java 2009-07-22 19:21:28 UTC (rev 3384)
+++ common-logging-spi/trunk/src/main/java/org/jboss/logging/NullNDCProvider.java 2009-07-22 19:21:47 UTC (rev 3385)
@@ -30,6 +30,8 @@
*/
public class NullNDCProvider implements NDCProvider
{
+ public static final NDCProvider INSTANCE = new NullNDCProvider();
+
public void clear()
{
}
More information about the jboss-svn-commits
mailing list