[jboss-svn-commits] JBoss Common SVN: r3206 - in jboss-logmanager/trunk: src/main/java/org/jboss/logmanager and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jun 2 19:01:16 EDT 2009
Author: david.lloyd at jboss.com
Date: 2009-06-02 19:01:16 -0400 (Tue, 02 Jun 2009)
New Revision: 3206
Added:
jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Slf4jLogger.java
Modified:
jboss-logmanager/trunk/pom.xml
jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/AtomicArray.java
jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/LogService.java
jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java
jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/LoggerPluginImpl.java
jboss-logmanager/trunk/src/main/java/org/slf4j/impl/Slf4jLoggerFactory.java
jboss-logmanager/trunk/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
jboss-logmanager/trunk/src/main/java/org/slf4j/impl/StaticMDCBinder.java
Log:
Make slf4j dependency optional by taking advantage of the SPI that I created for the JBoss Logging plugin impl.
Modified: jboss-logmanager/trunk/pom.xml
===================================================================
--- jboss-logmanager/trunk/pom.xml 2009-05-29 14:41:33 UTC (rev 3205)
+++ jboss-logmanager/trunk/pom.xml 2009-06-02 23:01:16 UTC (rev 3206)
@@ -35,6 +35,7 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.6</version>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
@@ -49,6 +50,12 @@
<version>2.1.0.GA</version>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>javax.time</groupId>
+ <artifactId>jsr-310-ri</artifactId>
+ <version>20090601</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
Modified: jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/AtomicArray.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/AtomicArray.java 2009-05-29 14:41:33 UTC (rev 3205)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/AtomicArray.java 2009-06-02 23:01:16 UTC (rev 3206)
@@ -371,6 +371,8 @@
private static <V> V[] newInstance(Class<V> componentType, int length) {
if (componentType == Handler.class) {
return (V[]) new Handler[length];
+ } else if (componentType == Object.class) {
+ return (V[]) new Object[length];
} else {
return (V[]) Array.newInstance(componentType, length);
}
Modified: jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/LogService.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/LogService.java 2009-05-29 14:41:33 UTC (rev 3205)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/LogService.java 2009-06-02 23:01:16 UTC (rev 3206)
@@ -77,7 +77,7 @@
if (handler != null) handler.flush();
} catch (Throwable t) {
// todo - might this loop somehow?
- log.error("Error flushing a log handler", t);
+ log.log(Level.ERROR, "Error flushing a log handler", t);
}
}
@@ -86,7 +86,7 @@
if (handler != null) handler.close();
} catch (Throwable t) {
// todo - might this loop somehow?
- log.error("Error closing a log handler", t);
+ log.log(Level.ERROR, "Error closing a log handler", t);
}
}
Modified: jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java 2009-05-29 14:41:33 UTC (rev 3205)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java 2009-06-02 23:01:16 UTC (rev 3206)
@@ -22,13 +22,11 @@
package org.jboss.logmanager;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
import java.util.ResourceBundle;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import java.util.concurrent.locks.Lock;
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-import org.slf4j.Marker;
-import org.slf4j.spi.LocationAwareLogger;
import java.util.logging.Filter;
import java.util.logging.Handler;
@@ -39,7 +37,7 @@
* An actual logger instance. This is the end-user interface into the logging system.
*/
@SuppressWarnings({ "SerializableClassWithUnconstructableAncestor" })
-public final class Logger extends java.util.logging.Logger implements LocationAwareLogger, Serializable {
+public final class Logger extends java.util.logging.Logger implements Serializable {
private static final long serialVersionUID = 5093333069125075416L;
@@ -268,7 +266,7 @@
*
* @param record the log record
*/
- private void doLog(final LogRecord record) {
+ void doLog(final LogRecord record) {
doLog((record instanceof ExtLogRecord) ? (ExtLogRecord) record : new ExtLogRecord(record, LOGGER_CLASS_NAME));
}
@@ -330,12 +328,12 @@
private static final int FINER_INT = Level.FINER.intValue();
private static final int FINEST_INT = Level.FINEST.intValue();
- private static final int ALT_FATAL_INT = org.jboss.logmanager.Level.FATAL.intValue();
- private static final int ALT_ERROR_INT = org.jboss.logmanager.Level.ERROR.intValue();
- private static final int ALT_WARN_INT = org.jboss.logmanager.Level.WARN.intValue();
- private static final int ALT_INFO_INT = org.jboss.logmanager.Level.INFO.intValue();
- private static final int ALT_DEBUG_INT = org.jboss.logmanager.Level.DEBUG.intValue();
- private static final int ALT_TRACE_INT = org.jboss.logmanager.Level.TRACE.intValue();
+ static final int ALT_FATAL_INT = org.jboss.logmanager.Level.FATAL.intValue();
+ static final int ALT_ERROR_INT = org.jboss.logmanager.Level.ERROR.intValue();
+ static final int ALT_WARN_INT = org.jboss.logmanager.Level.WARN.intValue();
+ static final int ALT_INFO_INT = org.jboss.logmanager.Level.INFO.intValue();
+ static final int ALT_DEBUG_INT = org.jboss.logmanager.Level.DEBUG.intValue();
+ static final int ALT_TRACE_INT = org.jboss.logmanager.Level.TRACE.intValue();
/** {@inheritDoc} */
public void log(LogRecord record) {
@@ -658,600 +656,4 @@
doLog(rec);
}
}
-
- // slf4j implementation
-
- /** {@inheritDoc} */
- public void log(final Marker marker, final String fqcn, final int levelVal, final String message, final Throwable t) {
- // ignore marker
- final Level level;
- switch (levelVal) {
- case LocationAwareLogger.TRACE_INT: level = org.jboss.logmanager.Level.TRACE; break;
- case LocationAwareLogger.DEBUG_INT: level = org.jboss.logmanager.Level.DEBUG; break;
- case LocationAwareLogger.INFO_INT: level = org.jboss.logmanager.Level.INFO; break;
- case LocationAwareLogger.WARN_INT: level = org.jboss.logmanager.Level.WARN; break;
- case LocationAwareLogger.ERROR_INT: level = org.jboss.logmanager.Level.ERROR; break;
- default: level = org.jboss.logmanager.Level.DEBUG; break;
- }
- final ExtLogRecord rec = new ExtLogRecord(level, message, fqcn);
- rec.setThrown(t);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public boolean isTraceEnabled() {
- return ALT_TRACE_INT < effectiveLevel;
- }
-
- /** {@inheritDoc} */
- public void trace(final String msg) {
- if (ALT_TRACE_INT < effectiveLevel) {
- return;
- }
- doLog(new ExtLogRecord(org.jboss.logmanager.Level.TRACE, msg, LOGGER_CLASS_NAME));
- }
-
- /** {@inheritDoc} */
- public void trace(final String format, final Object arg) {
- if (ALT_TRACE_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void trace(final String format, final Object arg1, final Object arg2) {
- if (ALT_TRACE_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg1, arg2 });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void trace(final String format, final Object[] argArray) {
- if (ALT_TRACE_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, format, LOGGER_CLASS_NAME);
- rec.setParameters(argArray);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void trace(final String msg, final Throwable t) {
- if (ALT_TRACE_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, msg, LOGGER_CLASS_NAME);
- rec.setThrown(t);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public boolean isTraceEnabled(final Marker marker) {
- return ALT_TRACE_INT < effectiveLevel;
- }
-
- /** {@inheritDoc} */
- public void trace(final Marker marker, final String msg) {
- if (ALT_TRACE_INT < effectiveLevel) {
- return;
- }
- doLog(new ExtLogRecord(org.jboss.logmanager.Level.TRACE, msg, LOGGER_CLASS_NAME));
- }
-
- /** {@inheritDoc} */
- public void trace(final Marker marker, final String format, final Object arg) {
- if (ALT_TRACE_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void trace(final Marker marker, final String format, final Object arg1, final Object arg2) {
- if (ALT_TRACE_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg1, arg2 });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void trace(final Marker marker, final String format, final Object[] argArray) {
- if (ALT_TRACE_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, format, LOGGER_CLASS_NAME);
- rec.setParameters(argArray);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void trace(final Marker marker, final String msg, final Throwable t) {
- if (ALT_TRACE_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, msg, LOGGER_CLASS_NAME);
- rec.setThrown(t);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public boolean isDebugEnabled() {
- return ALT_DEBUG_INT < effectiveLevel;
- }
-
- /** {@inheritDoc} */
- public void debug(final String msg) {
- if (ALT_DEBUG_INT < effectiveLevel) {
- return;
- }
- doLog(new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, msg, LOGGER_CLASS_NAME));
- }
-
- /** {@inheritDoc} */
- public void debug(final String format, final Object arg) {
- if (ALT_DEBUG_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void debug(final String format, final Object arg1, final Object arg2) {
- if (ALT_DEBUG_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg1, arg2 });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void debug(final String format, final Object[] argArray) {
- if (ALT_DEBUG_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, format, LOGGER_CLASS_NAME);
- rec.setParameters(argArray);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void debug(final String msg, final Throwable t) {
- if (ALT_DEBUG_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, msg, LOGGER_CLASS_NAME);
- rec.setThrown(t);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public boolean isDebugEnabled(final Marker marker) {
- return ALT_DEBUG_INT < effectiveLevel;
- }
-
- /** {@inheritDoc} */
- public void debug(final Marker marker, final String msg) {
- if (ALT_DEBUG_INT < effectiveLevel) {
- return;
- }
- doLog(new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, msg, LOGGER_CLASS_NAME));
- }
-
- /** {@inheritDoc} */
- public void debug(final Marker marker, final String format, final Object arg) {
- if (ALT_DEBUG_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void debug(final Marker marker, final String format, final Object arg1, final Object arg2) {
- if (ALT_DEBUG_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg1, arg2 });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void debug(final Marker marker, final String format, final Object[] argArray) {
- if (ALT_DEBUG_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, format, LOGGER_CLASS_NAME);
- rec.setParameters(argArray);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void debug(final Marker marker, final String msg, final Throwable t) {
- if (ALT_DEBUG_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, msg, LOGGER_CLASS_NAME);
- rec.setThrown(t);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public boolean isInfoEnabled() {
- return ALT_INFO_INT < effectiveLevel;
- }
-
- // info(String) is defined above, and happens to be compatible
-
- /** {@inheritDoc} */
- public void info(final String format, final Object arg) {
- if (ALT_INFO_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void info(final String format, final Object arg1, final Object arg2) {
- if (ALT_INFO_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg1, arg2 });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void info(final String format, final Object[] argArray) {
- if (ALT_INFO_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, format, LOGGER_CLASS_NAME);
- rec.setParameters(argArray);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void info(final String msg, final Throwable t) {
- if (ALT_INFO_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, msg, LOGGER_CLASS_NAME);
- rec.setThrown(t);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public boolean isInfoEnabled(final Marker marker) {
- return ALT_INFO_INT < effectiveLevel;
- }
-
- /** {@inheritDoc} */
- public void info(final Marker marker, final String msg) {
- if (ALT_INFO_INT < effectiveLevel) {
- return;
- }
- doLog(new ExtLogRecord(org.jboss.logmanager.Level.INFO, msg, LOGGER_CLASS_NAME));
- }
-
- /** {@inheritDoc} */
- public void info(final Marker marker, final String format, final Object arg) {
- if (ALT_INFO_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void info(final Marker marker, final String format, final Object arg1, final Object arg2) {
- if (ALT_INFO_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg1, arg2 });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void info(final Marker marker, final String format, final Object[] argArray) {
- if (ALT_INFO_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, format, LOGGER_CLASS_NAME);
- rec.setParameters(argArray);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void info(final Marker marker, final String msg, final Throwable t) {
- if (ALT_INFO_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, msg, LOGGER_CLASS_NAME);
- rec.setThrown(t);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public boolean isWarnEnabled() {
- return ALT_WARN_INT < effectiveLevel;
- }
-
- /** {@inheritDoc} */
- public void warn(final String msg) {
- if (ALT_WARN_INT < effectiveLevel) {
- return;
- }
- doLog(new ExtLogRecord(org.jboss.logmanager.Level.WARN, msg, LOGGER_CLASS_NAME));
- }
-
- /** {@inheritDoc} */
- public void warn(final String format, final Object arg) {
- if (ALT_WARN_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void warn(final String format, final Object arg1, final Object arg2) {
- if (ALT_WARN_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg1, arg2 });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void warn(final String format, final Object[] argArray) {
- if (ALT_WARN_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, format, LOGGER_CLASS_NAME);
- rec.setParameters(argArray);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void warn(final String msg, final Throwable t) {
- if (ALT_WARN_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, msg, LOGGER_CLASS_NAME);
- rec.setThrown(t);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public boolean isWarnEnabled(final Marker marker) {
- return ALT_WARN_INT < effectiveLevel;
- }
-
- /** {@inheritDoc} */
- public void warn(final Marker marker, final String msg) {
- if (ALT_WARN_INT < effectiveLevel) {
- return;
- }
- doLog(new ExtLogRecord(org.jboss.logmanager.Level.WARN, msg, LOGGER_CLASS_NAME));
- }
-
- /** {@inheritDoc} */
- public void warn(final Marker marker, final String format, final Object arg) {
- if (ALT_WARN_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void warn(final Marker marker, final String format, final Object arg1, final Object arg2) {
- if (ALT_WARN_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg1, arg2 });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void warn(final Marker marker, final String format, final Object[] argArray) {
- if (ALT_WARN_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, format, LOGGER_CLASS_NAME);
- rec.setParameters(argArray);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void warn(final Marker marker, final String msg, final Throwable t) {
- if (ALT_WARN_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, msg, LOGGER_CLASS_NAME);
- rec.setThrown(t);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public boolean isErrorEnabled() {
- return ALT_ERROR_INT < effectiveLevel;
- }
-
- /** {@inheritDoc} */
- public void error(final String msg) {
- if (ALT_ERROR_INT < effectiveLevel) {
- return;
- }
- doLog(new ExtLogRecord(org.jboss.logmanager.Level.ERROR, msg, LOGGER_CLASS_NAME));
- }
-
- /** {@inheritDoc} */
- public void error(final String format, final Object arg) {
- if (ALT_ERROR_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void error(final String format, final Object arg1, final Object arg2) {
- if (ALT_ERROR_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg1, arg2 });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void error(final String format, final Object[] argArray) {
- if (ALT_ERROR_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, format, LOGGER_CLASS_NAME);
- rec.setParameters(argArray);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void error(final String msg, final Throwable t) {
- if (ALT_ERROR_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, msg, LOGGER_CLASS_NAME);
- rec.setThrown(t);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public boolean isErrorEnabled(final Marker marker) {
- return ALT_ERROR_INT < effectiveLevel;
- }
-
- /** {@inheritDoc} */
- public void error(final Marker marker, final String msg) {
- if (ALT_ERROR_INT < effectiveLevel) {
- return;
- }
- doLog(new ExtLogRecord(org.jboss.logmanager.Level.ERROR, msg, LOGGER_CLASS_NAME));
- }
-
- /** {@inheritDoc} */
- public void error(final Marker marker, final String format, final Object arg) {
- if (ALT_ERROR_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void error(final Marker marker, final String format, final Object arg1, final Object arg2) {
- if (ALT_ERROR_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg1, arg2 });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void error(final Marker marker, final String format, final Object[] argArray) {
- if (ALT_ERROR_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, format, LOGGER_CLASS_NAME);
- rec.setParameters(argArray);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void error(final Marker marker, final String msg, final Throwable t) {
- if (ALT_ERROR_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, msg, LOGGER_CLASS_NAME);
- rec.setThrown(t);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public boolean isFatalEnabled() {
- return ALT_FATAL_INT < effectiveLevel;
- }
-
- /** {@inheritDoc} */
- public void fatal(final String msg) {
- if (ALT_FATAL_INT < effectiveLevel) {
- return;
- }
- doLog(new ExtLogRecord(org.jboss.logmanager.Level.FATAL, msg, LOGGER_CLASS_NAME));
- }
-
- /** {@inheritDoc} */
- public void fatal(final String format, final Object arg) {
- if (ALT_FATAL_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.FATAL, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void fatal(final String format, final Object arg1, final Object arg2) {
- if (ALT_FATAL_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.FATAL, format, LOGGER_CLASS_NAME);
- rec.setParameters(new Object[] { arg1, arg2 });
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void fatal(final String format, final Object[] argArray) {
- if (ALT_FATAL_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.FATAL, format, LOGGER_CLASS_NAME);
- rec.setParameters(argArray);
- doLog(rec);
- }
-
- /** {@inheritDoc} */
- public void fatal(final String msg, final Throwable t) {
- if (ALT_FATAL_INT < effectiveLevel) {
- return;
- }
- final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.FATAL, msg, LOGGER_CLASS_NAME);
- rec.setThrown(t);
- doLog(rec);
- }
}
Modified: jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/LoggerPluginImpl.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/LoggerPluginImpl.java 2009-05-29 14:41:33 UTC (rev 3205)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/LoggerPluginImpl.java 2009-06-02 23:01:16 UTC (rev 3206)
@@ -39,7 +39,7 @@
}
public boolean isTraceEnabled() {
- return logger.isTraceEnabled();
+ return logger.isLoggable(Level.TRACE);
}
public void trace(final Object message) {
@@ -56,7 +56,7 @@
@Deprecated
public boolean isDebugEnabled() {
- return logger.isDebugEnabled();
+ return logger.isLoggable(Level.DEBUG);
}
public void debug(final Object message) {
@@ -73,7 +73,7 @@
@Deprecated
public boolean isInfoEnabled() {
- return logger.isInfoEnabled();
+ return logger.isLoggable(Level.INFO);
}
public void info(final Object message) {
Added: jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Slf4jLogger.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Slf4jLogger.java (rev 0)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Slf4jLogger.java 2009-06-02 23:01:16 UTC (rev 3206)
@@ -0,0 +1,336 @@
+/*
+ * 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.logmanager;
+
+import org.slf4j.Marker;
+import org.slf4j.helpers.MarkerIgnoringBase;
+import org.slf4j.spi.LocationAwareLogger;
+
+import static org.jboss.logmanager.Logger.ALT_TRACE_INT;
+import static org.jboss.logmanager.Logger.ALT_DEBUG_INT;
+import static org.jboss.logmanager.Logger.ALT_INFO_INT;
+import static org.jboss.logmanager.Logger.ALT_WARN_INT;
+import static org.jboss.logmanager.Logger.ALT_ERROR_INT;
+import java.io.Serializable;
+import java.io.ObjectStreamException;
+
+public final class Slf4jLogger extends MarkerIgnoringBase implements Serializable, LocationAwareLogger {
+ private final Logger logger;
+ private static final String LOGGER_CLASS_NAME = Slf4jLogger.class.getName();
+ private static final long serialVersionUID = -8422185592693034532L;
+
+ public Slf4jLogger(final Logger logger) {
+ this.logger = logger;
+ }
+
+ public String getName() {
+ return logger.getName();
+ }
+
+ /** {@inheritDoc} */
+ public void log(final Marker marker, final String fqcn, final int levelVal, final String message, final Throwable t) {
+ // ignore marker
+ final java.util.logging.Level level;
+ switch (levelVal) {
+ case LocationAwareLogger.TRACE_INT: level = org.jboss.logmanager.Level.TRACE; break;
+ case LocationAwareLogger.DEBUG_INT: level = org.jboss.logmanager.Level.DEBUG; break;
+ case LocationAwareLogger.INFO_INT: level = org.jboss.logmanager.Level.INFO; break;
+ case LocationAwareLogger.WARN_INT: level = org.jboss.logmanager.Level.WARN; break;
+ case LocationAwareLogger.ERROR_INT: level = org.jboss.logmanager.Level.ERROR; break;
+ default: level = org.jboss.logmanager.Level.DEBUG; break;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(level, message, fqcn);
+ rec.setThrown(t);
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public boolean isTraceEnabled() {
+ return logger.isLoggable(Level.TRACE);
+ }
+
+ /** {@inheritDoc} */
+ public void trace(final String msg) {
+ if (ALT_TRACE_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ logger.doLog(new ExtLogRecord(org.jboss.logmanager.Level.TRACE, msg, LOGGER_CLASS_NAME));
+ }
+
+ /** {@inheritDoc} */
+ public void trace(final String format, final Object arg) {
+ if (ALT_TRACE_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, format, LOGGER_CLASS_NAME);
+ rec.setParameters(new Object[] { arg });
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void trace(final String format, final Object arg1, final Object arg2) {
+ if (ALT_TRACE_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, format, LOGGER_CLASS_NAME);
+ rec.setParameters(new Object[] { arg1, arg2 });
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void trace(final String format, final Object[] argArray) {
+ if (ALT_TRACE_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, format, LOGGER_CLASS_NAME);
+ rec.setParameters(argArray);
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void trace(final String msg, final Throwable t) {
+ if (ALT_TRACE_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.TRACE, msg, LOGGER_CLASS_NAME);
+ rec.setThrown(t);
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public boolean isDebugEnabled() {
+ return logger.isLoggable(Level.DEBUG);
+ }
+
+ /** {@inheritDoc} */
+ public void debug(final String msg) {
+ if (ALT_DEBUG_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ logger.doLog(new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, msg, LOGGER_CLASS_NAME));
+ }
+
+ /** {@inheritDoc} */
+ public void debug(final String format, final Object arg) {
+ if (ALT_DEBUG_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, format, LOGGER_CLASS_NAME);
+ rec.setParameters(new Object[] { arg });
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void debug(final String format, final Object arg1, final Object arg2) {
+ if (ALT_DEBUG_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, format, LOGGER_CLASS_NAME);
+ rec.setParameters(new Object[] { arg1, arg2 });
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void debug(final String format, final Object[] argArray) {
+ if (ALT_DEBUG_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, format, LOGGER_CLASS_NAME);
+ rec.setParameters(argArray);
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void debug(final String msg, final Throwable t) {
+ if (ALT_DEBUG_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.DEBUG, msg, LOGGER_CLASS_NAME);
+ rec.setThrown(t);
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public boolean isInfoEnabled() {
+ return logger.isLoggable(Level.INFO);
+ }
+
+ /** {@inheritDoc} */
+ public void info(final String msg) {
+ if (ALT_INFO_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ logger.doLog(new ExtLogRecord(org.jboss.logmanager.Level.INFO, msg, LOGGER_CLASS_NAME));
+ }
+
+ /** {@inheritDoc} */
+ public void info(final String format, final Object arg) {
+ if (ALT_INFO_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, format, LOGGER_CLASS_NAME);
+ rec.setParameters(new Object[] { arg });
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void info(final String format, final Object arg1, final Object arg2) {
+ if (ALT_INFO_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, format, LOGGER_CLASS_NAME);
+ rec.setParameters(new Object[] { arg1, arg2 });
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void info(final String format, final Object[] argArray) {
+ if (ALT_INFO_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, format, LOGGER_CLASS_NAME);
+ rec.setParameters(argArray);
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void info(final String msg, final Throwable t) {
+ if (ALT_INFO_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.INFO, msg, LOGGER_CLASS_NAME);
+ rec.setThrown(t);
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public boolean isWarnEnabled() {
+ return logger.isLoggable(Level.WARN);
+ }
+
+ /** {@inheritDoc} */
+ public void warn(final String msg) {
+ if (ALT_WARN_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ logger.doLog(new ExtLogRecord(org.jboss.logmanager.Level.WARN, msg, LOGGER_CLASS_NAME));
+ }
+
+ /** {@inheritDoc} */
+ public void warn(final String format, final Object arg) {
+ if (ALT_WARN_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, format, LOGGER_CLASS_NAME);
+ rec.setParameters(new Object[] { arg });
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void warn(final String format, final Object arg1, final Object arg2) {
+ if (ALT_WARN_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, format, LOGGER_CLASS_NAME);
+ rec.setParameters(new Object[] { arg1, arg2 });
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void warn(final String format, final Object[] argArray) {
+ if (ALT_WARN_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, format, LOGGER_CLASS_NAME);
+ rec.setParameters(argArray);
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void warn(final String msg, final Throwable t) {
+ if (ALT_WARN_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.WARN, msg, LOGGER_CLASS_NAME);
+ rec.setThrown(t);
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public boolean isErrorEnabled() {
+ return logger.isLoggable(Level.ERROR);
+ }
+
+ /** {@inheritDoc} */
+ public void error(final String msg) {
+ if (ALT_ERROR_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ logger.doLog(new ExtLogRecord(org.jboss.logmanager.Level.ERROR, msg, LOGGER_CLASS_NAME));
+ }
+
+ /** {@inheritDoc} */
+ public void error(final String format, final Object arg) {
+ if (ALT_ERROR_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, format, LOGGER_CLASS_NAME);
+ rec.setParameters(new Object[] { arg });
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void error(final String format, final Object arg1, final Object arg2) {
+ if (ALT_ERROR_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, format, LOGGER_CLASS_NAME);
+ rec.setParameters(new Object[] { arg1, arg2 });
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void error(final String format, final Object[] argArray) {
+ if (ALT_ERROR_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, format, LOGGER_CLASS_NAME);
+ rec.setParameters(argArray);
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ public void error(final String msg, final Throwable t) {
+ if (ALT_ERROR_INT < logger.getEffectiveLevel()) {
+ return;
+ }
+ final ExtLogRecord rec = new ExtLogRecord(org.jboss.logmanager.Level.ERROR, msg, LOGGER_CLASS_NAME);
+ rec.setThrown(t);
+ logger.doLog(rec);
+ }
+
+ /** {@inheritDoc} */
+ protected Slf4jLogger readResolve() throws ObjectStreamException {
+ return this;
+ }
+}
Modified: jboss-logmanager/trunk/src/main/java/org/slf4j/impl/Slf4jLoggerFactory.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/slf4j/impl/Slf4jLoggerFactory.java 2009-05-29 14:41:33 UTC (rev 3205)
+++ jboss-logmanager/trunk/src/main/java/org/slf4j/impl/Slf4jLoggerFactory.java 2009-06-02 23:01:16 UTC (rev 3206)
@@ -25,10 +25,11 @@
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
import org.jboss.logmanager.LogContext;
+import org.jboss.logmanager.Slf4jLogger;
public final class Slf4jLoggerFactory implements ILoggerFactory {
public Logger getLogger(final String name) {
- return LogContext.getLogContext().getLogger(name);
+ return new Slf4jLogger(LogContext.getLogContext().getLogger(name));
}
}
Modified: jboss-logmanager/trunk/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/slf4j/impl/StaticLoggerBinder.java 2009-05-29 14:41:33 UTC (rev 3205)
+++ jboss-logmanager/trunk/src/main/java/org/slf4j/impl/StaticLoggerBinder.java 2009-06-02 23:01:16 UTC (rev 3206)
@@ -24,7 +24,6 @@
import org.slf4j.spi.LoggerFactoryBinder;
import org.slf4j.ILoggerFactory;
-import org.slf4j.impl.Slf4jLoggerFactory;
public final class StaticLoggerBinder implements LoggerFactoryBinder {
Modified: jboss-logmanager/trunk/src/main/java/org/slf4j/impl/StaticMDCBinder.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/slf4j/impl/StaticMDCBinder.java 2009-05-29 14:41:33 UTC (rev 3205)
+++ jboss-logmanager/trunk/src/main/java/org/slf4j/impl/StaticMDCBinder.java 2009-06-02 23:01:16 UTC (rev 3206)
@@ -23,7 +23,6 @@
package org.slf4j.impl;
import org.slf4j.spi.MDCAdapter;
-import org.slf4j.impl.Slf4jMDCAdapter;
public final class StaticMDCBinder {
More information about the jboss-svn-commits
mailing list