[slf4j-dev] svn commit: r123 - in slf4j/branches/marker-experiment/src: filtered-java/org/slf4j java/org/slf4j/impl
ceki at slf4j.org
ceki at slf4j.org
Wed Jul 13 19:51:25 CEST 2005
Author: ceki
Date: Wed Jul 13 19:51:24 2005
New Revision: 123
Added:
slf4j/branches/marker-experiment/src/filtered-java/org/slf4j/MarkerFactory.java
Modified:
slf4j/branches/marker-experiment/src/filtered-java/org/slf4j/LoggerFactory.java
slf4j/branches/marker-experiment/src/java/org/slf4j/impl/JDK14LoggerFactory.java
slf4j/branches/marker-experiment/src/java/org/slf4j/impl/NOPLoggerFactory.java
slf4j/branches/marker-experiment/src/java/org/slf4j/impl/SimpleLoggerFactory.java
Log:
Updated class names
Modified: slf4j/branches/marker-experiment/src/filtered-java/org/slf4j/LoggerFactory.java
==============================================================================
--- slf4j/branches/marker-experiment/src/filtered-java/org/slf4j/LoggerFactory.java (original)
+++ slf4j/branches/marker-experiment/src/filtered-java/org/slf4j/LoggerFactory.java Wed Jul 13 19:51:24 2005
@@ -31,8 +31,6 @@
*/
package org.slf4j;
-import org.slf4j.spi.LoggerAdapterFactory;
-
// WARNING
// WARNING Modifications MUST be made to the original file found at
// WARNING $SLF4J_HOME/src/filtered-java/org/slf4j/LoggerFactory.java
@@ -47,29 +45,29 @@
* @author Ceki Gülcü
*/
public class LoggerFactory {
- static LoggerAdapterFactory adapterFactory;
+ static ILoggerFactory loggerFactory;
//
// WARNING Do not modify copies but the original in
// $SLF4J_HOME/src/filtered-java/org/slf4j/
//
static {
- String adapterFactoryClassStr = "org.slf4j.impl. at IMPL@LoggerAdapterFactory";
- System.out.println("SLF4J built for " + adapterFactoryClassStr);
+ String loggerFactoryClassStr = "org.slf4j.impl. at IMPL@LoggerFactory";
+ System.out.println("SLF4J built for " + loggerFactoryClassStr);
- adapterFactory = getFactoryAdapterFromSystemProperties();
+ loggerFactory = getFactoryFromSystemProperties();
// if could not get an adapter from the system properties, bind statically
- if (adapterFactory != null) {
- System.out.println("However, SLF4J will use ["+adapterFactory.getClass().getName()
+ if (loggerFactory != null) {
+ System.out.println("However, SLF4J will use ["+loggerFactory.getClass().getName()
+ "] adapter factory from system properties.");
} else {
try {
- adapterFactory = new org.slf4j.impl. at IMPL@LoggerAdapterFactory();
+ loggerFactory = new org.slf4j.impl. at IMPL@LoggerFactory();
} catch (Exception e) {
// we should never get here
- reportFailure(
- "Could not instantiate instance of class [" + adapterFactoryClassStr + "]",
+ Util.reportFailure(
+ "Could not instantiate instance of class [" + loggerFactoryClassStr + "]",
e);
}
}
@@ -78,35 +76,35 @@
/**
* Fetch the appropriate adapter as intructed by the system propties.
*
- * @return The appropriate LoggerFactoryAdapter as directed from the
+ * @return The appropriate ILoggerFactory instance as directed from the
* system properties
*/
- private static LoggerAdapterFactory getFactoryAdapterFromSystemProperties() {
- String faFactoryClassName = null;
+ private static ILoggerFactory getFactoryFromSystemProperties() {
+ String factoryFactoryClassName = null;
try {
- faFactoryClassName = System.getProperty(Constants.LOGGER_FA_FACTORY_PROPERTY);
- if (faFactoryClassName == null) {
+ factoryFactoryClassName = System.getProperty(Constants.LOGGER_FACTORY_FACTORY_METHOD_NAME);
+ if (factoryFactoryClassName == null) {
return null;
}
- Class faFactoryClass = Class.forName(faFactoryClassName);
+ Class factoryFactoryClass = Class.forName(factoryFactoryClassName);
Class[] EMPTY_CLASS_ARRAY = { };
- java.lang.reflect.Method faFactoryMethod =
- faFactoryClass.getDeclaredMethod(
- Constants.FA_FACTORY_METHOD_NAME, EMPTY_CLASS_ARRAY);
- LoggerAdapterFactory adapterFactory =
- (LoggerAdapterFactory) faFactoryMethod.invoke(null, null);
- return adapterFactory;
+ java.lang.reflect.Method factoryFactoryMethod =
+ factoryFactoryClass.getDeclaredMethod(
+ Constants.LOGGER_FACTORY_FACTORY_METHOD_NAME, EMPTY_CLASS_ARRAY);
+ ILoggerFactory loggerFactory =
+ (ILoggerFactory) factoryFactoryMethod.invoke(null, null);
+ return loggerFactory;
} catch (Throwable t) {
- if (faFactoryClassName == null) {
- reportFailure(
- "Failed to fetch " + Constants.LOGGER_FA_FACTORY_PROPERTY
+ if (factoryFactoryClassName == null) {
+ Util.reportFailure(
+ "Failed to fetch " + Constants.LOGGER_FACTORY_FACTORY_METHOD_NAME
+ " system property.", t);
} else {
- reportFailure(
- "Failed to fetch LoggerFactoryAdapter using the "
- + faFactoryClassName + " class.", t);
+ Util.reportFailure(
+ "Failed to fetch ILoggerFactory instnace using the "
+ + factoryFactoryClassName + " class.", t);
}
}
@@ -114,12 +112,6 @@
return null;
}
- static void reportFailure(String msg, Throwable t) {
- System.err.println(msg);
- System.err.println("Reported exception follows.");
- t.printStackTrace();
- }
-
/**
* Return a logger named according to the name parameter using the
* previously bound {@link LoggerFactoryAdapter adapter}.
@@ -127,10 +119,10 @@
* @return logger
*/
public static Logger getLogger(String name) {
- return adapterFactory.getLogger(name);
+ return loggerFactory.getLogger(name);
}
public static Logger getLogger(Class clazz) {
- return adapterFactory.getLogger(clazz.getName());
+ return loggerFactory.getLogger(clazz.getName());
}
}
Added: slf4j/branches/marker-experiment/src/filtered-java/org/slf4j/MarkerFactory.java
==============================================================================
--- (empty file)
+++ slf4j/branches/marker-experiment/src/filtered-java/org/slf4j/MarkerFactory.java Wed Jul 13 19:51:24 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2004-2005 SLF4J.ORG
+ *
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+ * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+package org.slf4j;
+
+// WARNING
+// WARNING Modifications MUST be made to the original file found at
+// WARNING $SLF4J_HOME/src/filtered-java/org/slf4j/MarkerFactory.java
+// WARNING
+
+
+/**
+ * A static MarkerFactory bound to a specific {@link IMarkerFactory} instance at
+ * at compile time.
+ *
+ * @author Ceki Gulcu
+ */
+public class MarkerFactory {
+ static IMarkerFactory markerFactory;
+
+ //
+ // WARNING Do not modify copies but the original at
+ // $SLF4J_HOME/src/filtered-java/org/slf4j/
+ //
+ static {
+ String markerFactoryClassStr = "org.slf4j.impl. at MARKER_FACTORY_IMPL_PREFIX@MarkerFactory";
+ try {
+ markerFactory = new org.slf4j.impl. at MARKER_FACTORY_IMPL_PREFIX@MarkerFactory();
+ } catch (Exception e) {
+ // we should never get here
+ Util.reportFailure(
+ "Could not instantiate instance of class [" + markerFactoryClassStr + "]",
+ e);
+ }
+
+ }
+
+ /**
+ * Return a Marker instnace as specified by the name parameter using the
+ * previously bound {@link IMakerFactory marker factory instance}.
+ * @param name The name of the Marker.
+ * @return marker
+ */
+ public static Marker getMarker(String name) {
+ return markerFactory.getMarker(name);
+ }
+}
Modified: slf4j/branches/marker-experiment/src/java/org/slf4j/impl/JDK14LoggerFactory.java
==============================================================================
--- slf4j/branches/marker-experiment/src/java/org/slf4j/impl/JDK14LoggerFactory.java (original)
+++ slf4j/branches/marker-experiment/src/java/org/slf4j/impl/JDK14LoggerFactory.java Wed Jul 13 19:51:24 2005
@@ -34,18 +34,18 @@
package org.slf4j.impl;
import org.slf4j.Logger;
-import org.slf4j.ILoggerrFactory;
+import org.slf4j.ILoggerFactory;
import java.util.HashMap;
import java.util.Map;
/**
- * JDK14LoggerFactory is an implementation of {@link ILoggerrFactory}
+ * JDK14LoggerFactory is an implementation of {@link ILoggerFactory}
* returning the appropriate named {@link JDK14LoggerAdapter} instance.
*
* @author Ceki Gülcü
*/
-public class JDK14LoggerFactory implements ILoggerrFactory {
+public class JDK14LoggerFactory implements ILoggerFactory {
// key: name (String), value: a JDK14LoggerAdapter;
Map loggerMap;
@@ -55,7 +55,7 @@
}
/* (non-Javadoc)
- * @see org.slf4j.ILoggerrFactory#getLogger(java.lang.String)
+ * @see org.slf4j.ILoggerFactory#getLogger(java.lang.String)
*/
public Logger getLogger(String name) {
Logger ulogger = (Logger) loggerMap.get(name);
Modified: slf4j/branches/marker-experiment/src/java/org/slf4j/impl/NOPLoggerFactory.java
==============================================================================
--- slf4j/branches/marker-experiment/src/java/org/slf4j/impl/NOPLoggerFactory.java (original)
+++ slf4j/branches/marker-experiment/src/java/org/slf4j/impl/NOPLoggerFactory.java Wed Jul 13 19:51:24 2005
@@ -34,17 +34,17 @@
package org.slf4j.impl;
import org.slf4j.Logger;
-import org.slf4j.ILoggerrFactory;
+import org.slf4j.ILoggerFactory;
/**
* NOPLoggerFactory is an trivial implementation of {@link
- * ILoggerrFactory} which always returns the unique instance of
+ * ILoggerFactory} which always returns the unique instance of
* NOPLogger.
*
* @author Ceki Gulcu
*/
-public class NOPLoggerFactory implements ILoggerrFactory {
+public class NOPLoggerFactory implements ILoggerFactory {
public NOPLoggerFactory() {
// nothing to do
Modified: slf4j/branches/marker-experiment/src/java/org/slf4j/impl/SimpleLoggerFactory.java
==============================================================================
--- slf4j/branches/marker-experiment/src/java/org/slf4j/impl/SimpleLoggerFactory.java (original)
+++ slf4j/branches/marker-experiment/src/java/org/slf4j/impl/SimpleLoggerFactory.java Wed Jul 13 19:51:24 2005
@@ -37,16 +37,16 @@
import java.util.Map;
import org.slf4j.Logger;
-import org.slf4j.ILoggerrFactory;
+import org.slf4j.ILoggerFactory;
/**
- * An implementation of {@link ILoggerrFactory} which always returns
+ * An implementation of {@link ILoggerFactory} which always returns
* {@link SimpleLogger} instances.
*
* @author Ceki Gülcü
*/
-public class SimpleLoggerFactory implements ILoggerrFactory {
+public class SimpleLoggerFactory implements ILoggerFactory {
Map map;
@@ -70,7 +70,7 @@
/*
* (non-Javadoc)
- * @see org.slf4j.ILoggerrFactory#getLogger(java.lang.String, java.lang.String)
+ * @see org.slf4j.ILoggerFactory#getLogger(java.lang.String, java.lang.String)
*/
public Logger getLogger(String domainName, String subDomainName) {
return getLogger(domainName);
More information about the slf4j-dev
mailing list