You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by rg...@apache.org on 2011/02/07 02:11:41 UTC
svn commit: r1067833 [1/2] - in
/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers: ./
log4j2-api/src/main/java/org/apache/logging/log4j/
log4j2-api/src/main/java/org/apache/logging/log4j/spi/
log4j2-api/src/test/java/org/apache/logging/log4j/ log4...
Author: rgoers
Date: Mon Feb 7 01:11:40 2011
New Revision: 1067833
URL: http://svn.apache.org/viewvc?rev=1067833&view=rev
Log:
Add support for SLF4J API
Added:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/MarkerManager.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
- copied, changed from r1029218, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RolloverStrategy.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/LoggerTest.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-test2.xml
- copied, changed from r1029218, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-test1.xml
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/pom.xml
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/apache/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/apache/logging/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/apache/logging/log4j/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/helpers/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/helpers/Log4JLoggerFactory.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/helpers/Log4JMDCAdapter.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/helpers/Log4JMarkerFactory.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/helpers/MarkerWrapper.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/impl/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/impl/Log4JLogger.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/impl/StaticMDCBinder.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/test/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/test/java/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/test/java/org/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/test/java/org/apache/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/test/java/org/apache/logging/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/test/java/org/apache/logging/slf4j/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/test/resources/
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/test/resources/log4j-test1.xml
Modified:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/Logger.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/Marker.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/test/java/org/apache/logging/log4j/LoggerTest.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/filter/MarkerFilterTest.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/pom.xml
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/Logger.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/Logger.java?rev=1067833&r1=1067832&r2=1067833&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/Logger.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/Logger.java Mon Feb 7 01:11:40 2011
@@ -26,14 +26,6 @@ import org.apache.logging.log4j.message.
*/
public interface Logger {
- static Marker FLOW_MARKER = Marker.getMarker("FLOW");
- static Marker ENTRY_MARKER = Marker.getMarker("ENTRY", FLOW_MARKER);
- static Marker EXIT_MARKER = Marker.getMarker("EXIT", FLOW_MARKER);
-
- static Marker EXCEPTION_MARKER = Marker.getMarker("EXCEPTION");
- static Marker THROWING_MARKER = Marker.getMarker("THROWING", EXCEPTION_MARKER);
- static Marker CATCHING_MARKER = Marker.getMarker("CATCHING", EXCEPTION_MARKER);
-
/**
* Log entry to a method.
*/
@@ -95,6 +87,14 @@ public interface Logger {
void trace(String message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#TRACE TRACE} level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ */
+ void trace(Marker marker, String message);
+
+ /**
* Log a message at the <code>TRACE</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
* <p/>
@@ -108,6 +108,20 @@ public interface Logger {
void trace(String message, Throwable t);
/**
+ * Log a message at the <code>TRACE</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ * <p/>
+ * <p>
+ * See {@link #debug(String)} form for more detailed information.
+ * </p>
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void trace(Marker marker, String message, Throwable t);
+
+ /**
* Log a message object with the {@link org.apache.logging.log4j.Level#TRACE TRACE} level.
*
* @param message the message object to log.
@@ -115,6 +129,14 @@ public interface Logger {
void trace(Object message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#TRACE TRACE} level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ */
+ void trace(Marker marker, Object message);
+
+ /**
* Log a message at the <code>TRACE</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
* <p/>
@@ -127,6 +149,20 @@ public interface Logger {
*/
void trace(Object message, Throwable t);
+ /**
+ * Log a message at the <code>TRACE</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ * <p/>
+ * <p>
+ * See {@link #debug(String)} form for more detailed information.
+ * </p>
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void trace(Marker marker, Object message, Throwable t);
+
/**
* Log a message with parameters at the <code>TRACE</code> level.
* @param message the message to log.
@@ -135,6 +171,15 @@ public interface Logger {
void trace(String message, Object... params);
/**
+ * Log a message with parameters at the <code>TRACE</code> level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message to log.
+ * @param params parameters to the message.
+ */
+ void trace(Marker marker, String message, Object... params);
+
+ /**
* Check whether this Logger is enabled for the TRACE Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
@@ -191,6 +236,14 @@ public interface Logger {
void debug(String message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#DEBUG DEBUG} level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ */
+ void debug(Marker marker, String message);
+
+ /**
* Log a message at the <code>DEBUG</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -200,6 +253,16 @@ public interface Logger {
void debug(String message, Throwable t);
/**
+ * Log a message at the <code>DEBUG</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void debug(Marker marker, String message, Throwable t);
+
+ /**
* Log a message object with the {@link org.apache.logging.log4j.Level#DEBUG DEBUG} level.
*
* @param message the message object to log.
@@ -207,6 +270,14 @@ public interface Logger {
void debug(Object message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#DEBUG DEBUG} level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ */
+ void debug(Marker marker, Object message);
+
+ /**
* Log a message at the <code>DEBUG</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -216,6 +287,16 @@ public interface Logger {
void debug(Object message, Throwable t);
/**
+ * Log a message at the <code>DEBUG</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void debug(Marker marker, Object message, Throwable t);
+
+ /**
* Log a message with parameters at the <code>DEBUG</code> level.
* @param message the message to log.
* @param params parameters to the message.
@@ -223,6 +304,15 @@ public interface Logger {
void debug(String message, Object... params);
/**
+ * Log a message with parameters at the <code>DEBUG</code> level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message to log.
+ * @param params parameters to the message.
+ */
+ void debug(Marker marker, String message, Object... params);
+
+ /**
* Check whether this Logger is enabled for the DEBUG Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
@@ -279,6 +369,14 @@ public interface Logger {
void info(String message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#INFO INFO} level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ */
+ void info(Marker marker, String message);
+
+ /**
* Log a message at the <code>INFO</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -288,6 +386,16 @@ public interface Logger {
void info(String message, Throwable t);
/**
+ * Log a message at the <code>INFO</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void info(Marker marker, String message, Throwable t);
+
+ /**
* Log a message object with the {@link org.apache.logging.log4j.Level#INFO INFO} level.
*
* @param message the message object to log.
@@ -295,6 +403,14 @@ public interface Logger {
void info(Object message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#INFO INFO} level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ */
+ void info(Marker marker, Object message);
+
+ /**
* Log a message at the <code>INFO</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -304,9 +420,21 @@ public interface Logger {
void info(Object message, Throwable t);
/**
+ * Log a message at the <code>INFO</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void info(Marker marker, Object message, Throwable t);
+
+ /**
* Log a message with parameters at the <code>INFO</code> level.
+ *
* @param message the message to log.
* @param params parameters to the message.
+ *
* @doubt Likely to misinterpret existing log4j client code that intended to call
* info(Object,Throwable). Incurs array creation expense on every call. (RG) It isn't
* possible to be misinterpreted as the previous method is for that signature. Methods
@@ -315,6 +443,19 @@ public interface Logger {
void info(String message, Object... params);
/**
+ * Log a message with parameters at the <code>INFO</code> level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message to log.
+ * @param params parameters to the message.
+ *
+ * @doubt Likely to misinterpret existing log4j client code that intended to call
+ * info(Object,Throwable). Incurs array creation expense on every call. (RG) It isn't
+ * possible to be misinterpreted as the previous method is for that signature. Methods
+ * should be added to avoid varargs for 1, 2 or 3 parameters.
+ */
+ void info(Marker marker, String message, Object... params);
+ /**
* Check whether this Logger is enabled for the INFO Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
@@ -363,7 +504,7 @@ public interface Logger {
*/
void info(Marker marker, Message msg, Throwable t);
- /**
+ /**
* Log a message object with the {@link org.apache.logging.log4j.Level#WARN WARN} level.
*
* @param message the message object to log.
@@ -371,6 +512,14 @@ public interface Logger {
void warn(String message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#WARN WARN} level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ */
+ void warn(Marker marker, String message);
+
+ /**
* Log a message at the <code>WARN</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -379,6 +528,16 @@ public interface Logger {
*/
void warn(String message, Throwable t);
+ /**
+ * Log a message at the <code>WARN</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void warn(Marker marker, String message, Throwable t);
+
/**
* Log a message object with the {@link org.apache.logging.log4j.Level#WARN WARN} level.
*
@@ -387,6 +546,14 @@ public interface Logger {
void warn(Object message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#WARN WARN} level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ */
+ void warn(Marker marker, Object message);
+
+ /**
* Log a message at the <code>WARN</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -396,6 +563,16 @@ public interface Logger {
void warn(Object message, Throwable t);
/**
+ * Log a message at the <code>WARN</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void warn(Marker marker, Object message, Throwable t);
+
+ /**
* Log a message with parameters at the <code>WARN</code> level.
* @param message the message to log.
* @param params parameters to the message.
@@ -407,6 +584,20 @@ public interface Logger {
void warn(String message, Object... params);
/**
+ * Log a message with parameters at the <code>WARN</code> level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message to log.
+ * @param params parameters to the message.
+ *
+ * @doubt Likely to misinterpret existing log4j client code that intended to call
+ * info(Object,Throwable). Incurs array creation expense on every call. (RG) I assume you
+ * meant warn, not info. It isn't possible to be misinterpreted as the previous method
+ * is for that signature.Methods should be added to avoid varargs for 1, 2 or 3 parameters.
+ */
+ void warn(Marker marker, String message, Object... params);
+
+ /**
* Check whether this Logger is enabled for the WARN Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
@@ -463,6 +654,14 @@ public interface Logger {
void error(String message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#ERROR ERROR} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ void error(Marker marker, String message);
+
+ /**
* Log a message at the <code>ERROR</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -472,6 +671,16 @@ public interface Logger {
void error(String message, Throwable t);
/**
+ * Log a message at the <code>ERROR</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void error(Marker marker, String message, Throwable t);
+
+ /**
* Log a message object with the {@link org.apache.logging.log4j.Level#ERROR ERROR} level.
*
* @param message the message object to log.
@@ -479,6 +688,14 @@ public interface Logger {
void error(Object message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#ERROR ERROR} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ void error(Marker marker, Object message);
+
+ /**
* Log a message at the <code>ERROR</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -488,9 +705,21 @@ public interface Logger {
void error(Object message, Throwable t);
/**
+ * Log a message at the <code>ERROR</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void error(Marker marker, Object message, Throwable t);
+
+ /**
* Log a message with parameters at the <code>ERROR</code> level.
+ *
* @param message the message to log.
* @param params parameters to the message.
+ *
* @doubt Likely to misinterpret existing log4j client code that intended to call
* info(Object,Throwable). Incurs array creation expense on every call. (RG) I assume you
* meant error, not info. It isn't possible to be misinterpreted as the previous method
@@ -499,6 +728,19 @@ public interface Logger {
void error(String message, Object... params);
/**
+ * Log a message with parameters at the <code>ERROR</code> level.
+ * @param marker the marker data specific to this log statement.
+ * @param message the message to log.
+ * @param params parameters to the message.
+ *
+ * @doubt Likely to misinterpret existing log4j client code that intended to call
+ * info(Object,Throwable). Incurs array creation expense on every call. (RG) I assume you
+ * meant error, not info. It isn't possible to be misinterpreted as the previous method
+ * is for that signature. Methods should be added to avoid varargs for 1, 2 or 3 parameters.
+ */
+ void error(Marker marker, String message, Object... params);
+
+ /**
* Check whether this Logger is enabled for the ERROR Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
@@ -555,6 +797,14 @@ public interface Logger {
void fatal(String message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#FATAL FATAL} level.
+ *
+ * @param marker The marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ void fatal(Marker marker, String message);
+
+ /**
* Log a message at the <code>FATAL</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -563,7 +813,18 @@ public interface Logger {
*/
void fatal(String message, Throwable t);
- /**
+
+ /**
+ * Log a message at the <code>FATAL</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker The marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void fatal(Marker marker, String message, Throwable t);
+
+ /**
* Log a message object with the {@link org.apache.logging.log4j.Level#FATAL FATAL} level.
*
* @param message the message object to log.
@@ -571,6 +832,14 @@ public interface Logger {
void fatal(Object message);
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#FATAL FATAL} level.
+ *
+ * @param marker The marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ void fatal(Marker marker, Object message);
+
+ /**
* Log a message at the <code>FATAL</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -578,10 +847,24 @@ public interface Logger {
* @param t the exception to log, including its stack trace.
*/
void fatal(Object message, Throwable t);
+
+ /**
+ * Log a message at the <code>FATAL</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker The marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ void fatal(Marker marker, Object message, Throwable t);
+
/**
* Log a message with parameters at the <code>FATAL</code> level.
+ *
+ *
* @param message the message to log.
* @param params parameters to the message.
+ *
* @doubt Likely to misinterpret existing log4j client code that intended to call
* info(Object,Throwable). Incurs array creation expense on every call.(RG) I assume you
* meant fatal, not info. It isn't possible to be misinterpreted as the previous method
@@ -590,6 +873,20 @@ public interface Logger {
void fatal(String message, Object... params);
/**
+ * Log a message with parameters at the <code>FATAL</code> level.
+ *
+ * @param marker The marker data specific to this log statement.
+ * @param message the message to log.
+ * @param params parameters to the message.
+ *
+ * @doubt Likely to misinterpret existing log4j client code that intended to call
+ * info(Object,Throwable). Incurs array creation expense on every call.(RG) I assume you
+ * meant fatal, not info. It isn't possible to be misinterpreted as the previous method
+ * is for that signature. Methods should be added to avoid varargs for 1, 2 or 3 parameters.
+ */
+ void fatal(Marker marker, String message, Object... params);
+
+ /**
* Check whether this Logger is enabled for the FATAL Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/Marker.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/Marker.java?rev=1067833&r1=1067832&r2=1067833&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/Marker.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/Marker.java Mon Feb 7 01:11:40 2011
@@ -17,87 +17,14 @@
package org.apache.logging.log4j;
import java.io.Serializable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
/**
*/
-public class Marker implements Serializable {
+public interface Marker extends Serializable {
- private static ConcurrentMap<String, Marker> markerMap = new ConcurrentHashMap<String, Marker>();
+ public String getName();
- public static Marker getMarker(String name) {
- markerMap.putIfAbsent(name, new Marker(name));
- return markerMap.get(name);
- }
+ public Marker getParent();
- public static Marker getMarker(String name, String parent) {
- Marker parentMarker = markerMap.get(parent);
- if (parentMarker == null) {
- throw new IllegalArgumentException("Parent Marker " + parent + " has not been defined");
- }
- return getMarker(name, parentMarker);
- }
-
- public static Marker getMarker(String name, Marker parent) {
- markerMap.putIfAbsent(name, new Marker(name, parent));
- return markerMap.get(name);
- }
-
- private String name;
- private Marker parent;
-
- private Marker(String name) {
- this.name = name;
- }
-
- private Marker(String name, Marker parent) {
- this.name = name;
- this.parent = parent;
- }
-
- public String getName() {
- return this.name;
- }
-
- public Marker getParent() {
- return this.parent;
- }
-
- public boolean isInstanceOf(Marker m) {
- if (m == null) {
- throw new IllegalArgumentException("A marker parameter is required");
- }
- Marker test = this;
- do {
- if (test == m) {
- return true;
- }
- test = test.getParent();
- } while (test != null);
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
- Marker marker = (Marker) o;
-
- if (name != null ? !name.equals(marker.name) : marker.name != null) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return name != null ? name.hashCode() : 0;
- }
+ public boolean isInstanceOf(Marker m);
}
Added: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/MarkerManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/MarkerManager.java?rev=1067833&view=auto
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/MarkerManager.java (added)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/MarkerManager.java Mon Feb 7 01:11:40 2011
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+
+/**
+ *
+ */
+public class MarkerManager {
+
+ private static ConcurrentMap<String, Marker> markerMap = new ConcurrentHashMap<String, Marker>();
+
+ public static Marker getMarker(String name) {
+ markerMap.putIfAbsent(name, new Log4JMarker(name));
+ return markerMap.get(name);
+ }
+
+ public static Marker getMarker(String name, String parent) {
+ Marker parentMarker = markerMap.get(parent);
+ if (parentMarker == null) {
+ throw new IllegalArgumentException("Parent Marker " + parent + " has not been defined");
+ }
+ return getMarker(name, parentMarker);
+ }
+
+ public static Marker getMarker(String name, Marker parent) {
+ markerMap.putIfAbsent(name, new Log4JMarker(name, parent));
+ return markerMap.get(name);
+ }
+
+ private static class Log4JMarker implements Marker {
+
+ private static final long serialVersionUID = 100L;
+
+ private String name;
+ private Marker parent;
+
+ public Log4JMarker(String name) {
+ this.name = name;
+ }
+
+ public Log4JMarker(String name, Marker parent) {
+ this.name = name;
+ this.parent = parent;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public Marker getParent() {
+ return this.parent;
+ }
+
+ public boolean isInstanceOf(Marker m) {
+ if (m == null) {
+ throw new IllegalArgumentException("A marker parameter is required");
+ }
+ Marker test = this;
+ do {
+ if (test == m) {
+ return true;
+ }
+ test = test.getParent();
+ } while (test != null);
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Marker marker = (Marker) o;
+
+ if (name != null ? !name.equals(marker.getName()) : marker.getName() != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return name != null ? name.hashCode() : 0;
+ }
+ }
+}
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java?rev=1067833&r1=1067832&r2=1067833&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java Mon Feb 7 01:11:40 2011
@@ -19,6 +19,7 @@ package org.apache.logging.log4j.spi;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.MarkerManager;
import org.apache.logging.log4j.message.Message;
import org.apache.logging.log4j.message.ObjectMessage;
import org.apache.logging.log4j.message.ParameterizedMessage;
@@ -29,17 +30,25 @@ import org.apache.logging.log4j.message.
*/
public abstract class AbstractLogger implements Logger {
+ static Marker FLOW_MARKER = MarkerManager.getMarker("FLOW");
+ static Marker ENTRY_MARKER = MarkerManager.getMarker("ENTRY", FLOW_MARKER);
+ static Marker EXIT_MARKER = MarkerManager.getMarker("EXIT", FLOW_MARKER);
+
+ static Marker EXCEPTION_MARKER = MarkerManager.getMarker("EXCEPTION");
+ static Marker THROWING_MARKER = MarkerManager.getMarker("THROWING", EXCEPTION_MARKER);
+ static Marker CATCHING_MARKER = MarkerManager.getMarker("CATCHING", EXCEPTION_MARKER);
+
protected String getFQCN() {
return AbstractLogger.class.getName();
}
-
+
/**
* Log entry to a method.
*/
public void entry() {
- if (isEnabled(Level.TRACE, Logger.ENTRY_MARKER, (Object)null, null)) {
- log(Logger.ENTRY_MARKER, getFQCN(), Level.TRACE, new SimpleMessage(" entry"), null);
+ if (isEnabled(Level.TRACE, ENTRY_MARKER, (Object)null, null)) {
+ log(ENTRY_MARKER, getFQCN(), Level.TRACE, new SimpleMessage(" entry"), null);
}
}
@@ -50,8 +59,8 @@ public abstract class AbstractLogger imp
* @param params The parameters to the method.
*/
public void entry(Object... params) {
- if (isEnabled(Level.TRACE, Logger.ENTRY_MARKER, (Object)null, null)) {
- log(Logger.ENTRY_MARKER, getFQCN(), Level.TRACE, entryMsg(params.length, params), null);
+ if (isEnabled(Level.TRACE, ENTRY_MARKER, (Object)null, null)) {
+ log(ENTRY_MARKER, getFQCN(), Level.TRACE, entryMsg(params.length, params), null);
}
}
@@ -59,8 +68,8 @@ public abstract class AbstractLogger imp
* Log exit from a method.
*/
public void exit() {
- if (isEnabled(Level.TRACE, Logger.EXIT_MARKER, (Object)null, null)) {
- log(Logger.EXIT_MARKER, getFQCN(), Level.TRACE, exitMsg(null), null);
+ if (isEnabled(Level.TRACE, EXIT_MARKER, (Object)null, null)) {
+ log(EXIT_MARKER, getFQCN(), Level.TRACE, exitMsg(null), null);
}
}
@@ -70,8 +79,8 @@ public abstract class AbstractLogger imp
* @param result The result being returned from the method call.
*/
public void exit(Object result) {
- if (isEnabled(Level.TRACE, Logger.EXIT_MARKER, (Object)null, null)) {
- log(Logger.EXIT_MARKER, getFQCN(), Level.TRACE, exitMsg(result), null);
+ if (isEnabled(Level.TRACE, EXIT_MARKER, (Object)null, null)) {
+ log(EXIT_MARKER, getFQCN(), Level.TRACE, exitMsg(result), null);
}
}
@@ -81,8 +90,8 @@ public abstract class AbstractLogger imp
* @param t The Throwable.
*/
public void throwing(Throwable t) {
- if (isEnabled(Level.ERROR, Logger.THROWING_MARKER, (Object)null, null)) {
- log(Logger.THROWING_MARKER, getFQCN(), Level.ERROR, new SimpleMessage("throwing"), t);
+ if (isEnabled(Level.ERROR, THROWING_MARKER, (Object)null, null)) {
+ log(THROWING_MARKER, getFQCN(), Level.ERROR, new SimpleMessage("throwing"), t);
}
}
@@ -94,8 +103,8 @@ public abstract class AbstractLogger imp
* @param t The Throwable.
*/
public void throwing(Level level, Throwable t) {
- if (isEnabled(level, Logger.THROWING_MARKER, (Object)null, null)) {
- log(Logger.THROWING_MARKER, getFQCN(), level, new SimpleMessage("throwing"), t);
+ if (isEnabled(level, THROWING_MARKER, (Object)null, null)) {
+ log(THROWING_MARKER, getFQCN(), level, new SimpleMessage("throwing"), t);
}
}
@@ -105,8 +114,8 @@ public abstract class AbstractLogger imp
* @param t The Throwable.
*/
public void catching(Throwable t) {
- if (isEnabled(Level.DEBUG, Logger.THROWING_MARKER, (Object)null, null)) {
- log(Logger.THROWING_MARKER, getFQCN(), Level.DEBUG, new SimpleMessage("catching"), t);
+ if (isEnabled(Level.DEBUG, THROWING_MARKER, (Object)null, null)) {
+ log(THROWING_MARKER, getFQCN(), Level.DEBUG, new SimpleMessage("catching"), t);
}
}
@@ -117,8 +126,8 @@ public abstract class AbstractLogger imp
* @param t The Throwable.
*/
public void catching(Level level, Throwable t) {
- if (isEnabled(level, Logger.THROWING_MARKER, (Object)null, null)) {
- log(Logger.THROWING_MARKER, getFQCN(), level, new SimpleMessage("catching"), t);
+ if (isEnabled(level, THROWING_MARKER, (Object)null, null)) {
+ log(THROWING_MARKER, getFQCN(), level, new SimpleMessage("catching"), t);
}
}
@@ -134,6 +143,18 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#TRACE TRACE} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void trace(Marker marker, String message) {
+ if (isEnabled(Level.TRACE, marker, message)) {
+ log(marker, getFQCN(), Level.TRACE, new SimpleMessage(message), null);
+ }
+ }
+
+ /**
* Log a message at the <code>TRACE</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
* <p/>
@@ -150,6 +171,25 @@ public abstract class AbstractLogger imp
}
}
+
+ /**
+ * Log a message at the <code>TRACE</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ * <p/>
+ * <p>
+ * See {@link #debug(String)} form for more detailed information.
+ * </p>
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void trace(Marker marker, String message, Throwable t) {
+ if (isEnabled(Level.TRACE, marker, message, t)) {
+ log(marker, getFQCN(), Level.TRACE, new SimpleMessage(message), t);
+ }
+ }
+
/**
* Log a message object with the {@link org.apache.logging.log4j.Level#TRACE TRACE} level.
*
@@ -162,6 +202,18 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#TRACE TRACE} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void trace(Marker marker, Object message) {
+ if (isEnabled(Level.TRACE, marker, message, null)) {
+ log(marker, getFQCN(), Level.TRACE, new ObjectMessage(message), null);
+ }
+ }
+
+ /**
* Log a message at the <code>TRACE</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
* <p/>
@@ -179,6 +231,24 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message at the <code>TRACE</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ * <p/>
+ * <p>
+ * See {@link #debug(String)} form for more detailed information.
+ * </p>
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void trace(Marker marker, Object message, Throwable t) {
+ if (isEnabled(Level.TRACE, marker, message, t)) {
+ log(marker, getFQCN(), Level.TRACE, new ObjectMessage(message), t);
+ }
+ }
+
+ /**
* Log a message with parameters at the <code>TRACE</code> level.
*
* @param message the message to log.
@@ -191,6 +261,19 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message with parameters at the <code>TRACE</code> level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message to log.
+ * @param params parameters to the message.
+ */
+ public void trace(Marker marker, String message, Object... params) {
+ if (isEnabled(Level.TRACE, marker, message, params)) {
+ log(marker, getFQCN(), Level.TRACE, new ParameterizedMessage(message, params), null);
+ }
+ }
+
+ /**
* Check whether this Logger is enabled for the TRACE Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
@@ -236,7 +319,7 @@ public abstract class AbstractLogger imp
/**
* Log a message with the specific Marker at the TRACE level.
*
- * @param marker the marker data specific to this log statement
+ * @param marker the marker data specific to this log statement.
* @param msg the message string to be logged
*/
public void trace(Marker marker, Message msg) {
@@ -248,7 +331,7 @@ public abstract class AbstractLogger imp
/**
* Log a message with the specific Marker at the TRACE level.
*
- * @param marker the marker data specific to this log statement
+ * @param marker the marker data specific to this log statement.
* @param msg the message string to be logged
* @param t A Throwable or null.
*/
@@ -270,6 +353,18 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#DEBUG DEBUG} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void debug(Marker marker, String message) {
+ if (isEnabled(Level.DEBUG, marker, message)) {
+ log(marker, getFQCN(), Level.DEBUG, new SimpleMessage(message), null);
+ }
+ }
+
+ /**
* Log a message at the <code>DEBUG</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -283,6 +378,19 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message at the <code>DEBUG</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void debug(Marker marker, String message, Throwable t) {
+ if (isEnabled(Level.DEBUG, marker, message, t)) {
+ log(marker, getFQCN(), Level.DEBUG, new SimpleMessage(message), t);
+ }
+ }
+ /**
* Log a message object with the {@link org.apache.logging.log4j.Level#DEBUG DEBUG} level.
*
* @param message the message object to log.
@@ -294,6 +402,18 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#DEBUG DEBUG} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void debug(Marker marker, Object message) {
+ if (isEnabled(Level.DEBUG, marker, message, null)) {
+ log(marker, getFQCN(), Level.DEBUG, new ObjectMessage(message), null);
+ }
+ }
+
+ /**
* Log a message at the <code>DEBUG</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -305,6 +425,21 @@ public abstract class AbstractLogger imp
log(null, getFQCN(), Level.DEBUG, new ObjectMessage(message), t);
}
}
+
+ /**
+ * Log a message at the <code>DEBUG</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void debug(Marker marker, Object message, Throwable t) {
+ if (isEnabled(Level.DEBUG, marker, message, t)) {
+ log(marker, getFQCN(), Level.DEBUG, new ObjectMessage(message), t);
+ }
+ }
+
/**
* Log a message with parameters at the <code>DEBUG</code> level.
*
@@ -318,6 +453,19 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message with parameters at the <code>DEBUG</code> level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message to log.
+ * @param params parameters to the message.
+ */
+ public void debug(Marker marker, String message, Object... params) {
+ if (isEnabled(Level.DEBUG, marker, message, params)) {
+ log(marker, getFQCN(), Level.DEBUG, new ParameterizedMessage(message, params), null);
+ }
+ }
+
+ /**
* Check whether this Logger is enabled for the DEBUG Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
@@ -375,7 +523,7 @@ public abstract class AbstractLogger imp
/**
* Log a message with the specific Marker at the DEBUG level.
*
- * @param marker the marker data specific to this log statement
+ * @param marker the marker data specific to this log statement.
* @param msg the message string to be logged
* @param t A Throwable or null.
*/
@@ -397,6 +545,18 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#INFO INFO} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void info(Marker marker, String message) {
+ if (isEnabled(Level.INFO, marker, message)) {
+ log(marker, getFQCN(), Level.INFO, new SimpleMessage(message), null);
+ }
+ }
+
+ /**
* Log a message at the <code>INFO</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -410,6 +570,20 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message at the <code>INFO</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void info(Marker marker, String message, Throwable t) {
+ if (isEnabled(Level.INFO, marker, message, t)) {
+ log(marker, getFQCN(), Level.INFO, new SimpleMessage(message), t);
+ }
+ }
+
+ /**
* Log a message object with the {@link org.apache.logging.log4j.Level#INFO INFO} level.
*
* @param message the message object to log.
@@ -421,6 +595,18 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#INFO INFO} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void info(Marker marker, Object message) {
+ if (isEnabled(Level.INFO, marker, message, null)) {
+ log(marker, getFQCN(), Level.INFO, new ObjectMessage(message), null);
+ }
+ }
+
+ /**
* Log a message at the <code>INFO</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -433,6 +619,21 @@ public abstract class AbstractLogger imp
}
}
+
+ /**
+ * Log a message at the <code>INFO</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void info(Marker marker, Object message, Throwable t) {
+ if (isEnabled(Level.INFO, marker, message, t)) {
+ log(marker, getFQCN(), Level.INFO, new ObjectMessage(message), t);
+ }
+ }
+
/**
* Log a message with parameters at the <code>INFO</code> level.
*
@@ -446,6 +647,19 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message with parameters at the <code>INFO</code> level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message to log.
+ * @param params parameters to the message.
+ */
+ public void info(Marker marker, String message, Object... params) {
+ if (isEnabled(Level.INFO, marker, message, params)) {
+ log(marker, getFQCN(), Level.INFO, new ParameterizedMessage(message, params), null);
+ }
+ }
+
+ /**
* Check whether this Logger is enabled for the INFO Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
@@ -525,6 +739,18 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#WARN WARN} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void warn(Marker marker, String message) {
+ if (isEnabled(Level.WARN, marker, message)) {
+ log(marker, getFQCN(), Level.WARN, new SimpleMessage(message), null);
+ }
+ }
+
+ /**
* Log a message at the <code>WARN</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -538,6 +764,32 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message at the <code>WARN</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void warn(Marker marker, String message, Throwable t) {
+ if (isEnabled(Level.WARN, marker, message, t)) {
+ log(marker, getFQCN(), Level.DEBUG, new SimpleMessage(message), t);
+ }
+ }
+
+ /**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#WARN WARN} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void warn(Marker marker, Object message) {
+ if (isEnabled(Level.WARN, marker, message, null)) {
+ log(marker, getFQCN(), Level.WARN, new ObjectMessage(message), null);
+ }
+ }
+
+ /**
* Log a message object with the {@link org.apache.logging.log4j.Level#WARN WARN} level.
*
* @param message the message object to log.
@@ -562,6 +814,20 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message at the <code>WARN</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void warn(Marker marker, Object message, Throwable t) {
+ if (isEnabled(Level.WARN, marker, message, t)) {
+ log(marker, getFQCN(), Level.DEBUG, new ObjectMessage(message), t);
+ }
+ }
+
+ /**
* Log a message with parameters at the <code>WARN</code> level.
*
* @param message the message to log.
@@ -574,6 +840,19 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message with parameters at the <code>WARN</code> level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message to log.
+ * @param params parameters to the message.
+ */
+ public void warn(Marker marker, String message, Object... params) {
+ if (isEnabled(Level.WARN, marker, message, params)) {
+ log(marker, getFQCN(), Level.WARN, new ParameterizedMessage(message, params), null);
+ }
+ }
+
+ /**
* Check whether this Logger is enabled for the WARN Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
@@ -653,6 +932,18 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#ERROR ERROR} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void error(Marker marker, String message) {
+ if (isEnabled(Level.ERROR, marker, message)) {
+ log(marker, getFQCN(), Level.ERROR, new SimpleMessage(message), null);
+ }
+ }
+
+ /**
* Log a message at the <code>ERROR</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -666,6 +957,20 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message at the <code>ERROR</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void error(Marker marker, String message, Throwable t) {
+ if (isEnabled(Level.ERROR, marker, message, t)) {
+ log(marker, getFQCN(), Level.ERROR, new SimpleMessage(message), t);
+ }
+ }
+
+ /**
* Log a message object with the {@link org.apache.logging.log4j.Level#ERROR ERROR} level.
*
* @param message the message object to log.
@@ -677,6 +982,18 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#ERROR ERROR} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void error(Marker marker, Object message) {
+ if (isEnabled(Level.ERROR, marker, message, null)) {
+ log(marker, getFQCN(), Level.ERROR, new ObjectMessage(message), null);
+ }
+ }
+
+ /**
* Log a message at the <code>ERROR</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -690,6 +1007,20 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message at the <code>ERROR</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void error(Marker marker, Object message, Throwable t) {
+ if (isEnabled(Level.ERROR, marker, message, t)) {
+ log(marker, getFQCN(), Level.ERROR, new ObjectMessage(message), t);
+ }
+ }
+
+ /**
* Log a message with parameters at the <code>ERROR</code> level.
*
* @param message the message to log.
@@ -702,6 +1033,20 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message with parameters at the <code>ERROR</code> level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message to log.
+ * @param params parameters to the message.
+ */
+ public void error(Marker marker, String message, Object... params) {
+ if (isEnabled(Level.ERROR, marker, message, params)) {
+ log(marker, getFQCN(), Level.ERROR, new ParameterizedMessage(message, params), null);
+ }
+ }
+
+
+ /**
* Check whether this Logger is enabled for the ERROR Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
@@ -780,6 +1125,19 @@ public abstract class AbstractLogger imp
}
}
+
+ /**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#FATAL FATAL} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void fatal(Marker marker, String message) {
+ if (isEnabled(Level.FATAL, marker, message)) {
+ log(marker, getFQCN(), Level.FATAL, new SimpleMessage(message), null);
+ }
+ }
+
/**
* Log a message at the <code>FATAL</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
@@ -794,6 +1152,20 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message at the <code>FATAL</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void fatal(Marker marker, String message, Throwable t) {
+ if (isEnabled(Level.FATAL, marker, message, t)) {
+ log(marker, getFQCN(), Level.FATAL, new SimpleMessage(message), t);
+ }
+ }
+
+ /**
* Log a message object with the {@link org.apache.logging.log4j.Level#FATAL FATAL} level.
*
* @param message the message object to log.
@@ -805,6 +1177,18 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message object with the {@link org.apache.logging.log4j.Level#FATAL FATAL} level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ */
+ public void fatal(Marker marker, Object message) {
+ if (isEnabled(Level.FATAL, marker, message, null)) {
+ log(marker, getFQCN(), Level.FATAL, new ObjectMessage(message), null);
+ }
+ }
+
+ /**
* Log a message at the <code>FATAL</code> level including the
* stack trace of the {@link Throwable}<code>t</code> passed as parameter.
*
@@ -816,6 +1200,21 @@ public abstract class AbstractLogger imp
log(null, getFQCN(), Level.FATAL, new ObjectMessage(message), t);
}
}
+
+ /**
+ * Log a message at the <code>FATAL</code> level including the
+ * stack trace of the {@link Throwable}<code>t</code> passed as parameter.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message object to log.
+ * @param t the exception to log, including its stack trace.
+ */
+ public void fatal(Marker marker, Object message, Throwable t) {
+ if (isEnabled(Level.FATAL, marker, message, t)) {
+ log(marker, getFQCN(), Level.FATAL, new ObjectMessage(message), t);
+ }
+ }
+
/**
* Log a message with parameters at the <code>FATAL</code> level.
*
@@ -829,6 +1228,19 @@ public abstract class AbstractLogger imp
}
/**
+ * Log a message with parameters at the <code>FATAL</code> level.
+ *
+ * @param marker the marker data specific to this log statement.
+ * @param message the message to log.
+ * @param params parameters to the message.
+ */
+ public void fatal(Marker marker, String message, Object... params) {
+ if (isEnabled(Level.FATAL, marker, message, params)) {
+ log(marker, getFQCN(), Level.FATAL, new ParameterizedMessage(message, params), null);
+ }
+ }
+
+ /**
* Check whether this Logger is enabled for the FATAL Level.
*
* @return boolean - <code>true</code> if this Logger is enabled for level
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/test/java/org/apache/logging/log4j/LoggerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/test/java/org/apache/logging/log4j/LoggerTest.java?rev=1067833&r1=1067832&r2=1067833&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/test/java/org/apache/logging/log4j/LoggerTest.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/test/java/org/apache/logging/log4j/LoggerTest.java Mon Feb 7 01:11:40 2011
@@ -81,7 +81,7 @@ public class LoggerTest {
msg.put("ToAccount", "123456");
msg.put("FromAccount", "123457");
msg.put("Amount", "200.00");
- logger.info(Marker.getMarker("EVENT"), msg);
+ logger.info(MarkerManager.getMarker("EVENT"), msg);
ThreadContext.clear();
}
}
Copied: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java (from r1029218, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java?p2=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java&p1=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java&r1=1029218&r2=1067833&rev=1067833&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java Mon Feb 7 01:11:40 2011
@@ -16,8 +16,8 @@
*/
package org.apache.logging.log4j.core.appender;
-import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.config.plugins.PluginAttr;
import org.apache.logging.log4j.core.config.plugins.PluginElement;
@@ -31,20 +31,34 @@ import java.io.OutputStream;
/**
*
*/
-@Plugin(name="File",type="Core",elementType="appender",printObject=true)
-public class FileAppender extends OutputStreamAppender {
+@Plugin(name="RollingFile",type="Core",elementType="appender",printObject=true)
+public class RollingFileAppender extends OutputStreamAppender {
public static final String FILE_NAME = "fileName";
public static final String APPEND = "append";
public final String fileName;
- public FileAppender(String name, Layout layout, Filters filters, OutputStream os, String filename) {
+ public RollingFileAppender(String name, Layout layout, Filters filters, OutputStream os, String filename) {
super(name, layout, filters, os);
this.fileName = filename;
}
+ /**
+ * Actual writing occurs here.
+ * <p/>
+ * <p>Most subclasses of <code>OutputStreamAppender</code> will need to
+ * override this method.
+ * @param event The LogEvent.
+ */
+ @Override
+ protected void subAppend(LogEvent event) {
+
+ super.subAppend(event);
+ }
+
+
@PluginFactory
- public static FileAppender createAppender(@PluginAttr("fileName") String fileName,
+ public static RollingFileAppender createAppender(@PluginAttr("fileName") String fileName,
@PluginAttr("append") String append,
@PluginAttr("name") String name,
@PluginElement("layout") Layout layout,
@@ -64,7 +78,7 @@ public class FileAppender extends Output
try {
OutputStream os = new FileOutputStream(fileName, isAppend);
- return new FileAppender(name, layout, filters, os, fileName);
+ return new RollingFileAppender(name, layout, filters, os, fileName);
} catch (FileNotFoundException ex) {
logger.error("Unable to open file " + fileName, ex);
return null;
Added: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RolloverStrategy.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RolloverStrategy.java?rev=1067833&view=auto
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RolloverStrategy.java (added)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/RolloverStrategy.java Mon Feb 7 01:11:40 2011
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.appender;
+
+/**
+ *
+ */
+public interface RolloverStrategy
+{
+}
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java?rev=1067833&r1=1067832&r2=1067833&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java Mon Feb 7 01:11:40 2011
@@ -18,6 +18,7 @@ package org.apache.logging.log4j.core.fi
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.MarkerManager;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.config.plugins.Plugin;
@@ -72,7 +73,7 @@ public class MarkerFilter extends Filter
logger.error("A marker must be provided for MarkerFilter");
return null;
}
- Marker m = Marker.getMarker(marker);
+ Marker m = MarkerManager.getMarker(marker);
Result onMatch = match == null ? null : Result.valueOf(match);
Result onMismatch = mismatch == null ? null : Result.valueOf(mismatch);
Added: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/LoggerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/LoggerTest.java?rev=1067833&view=auto
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/LoggerTest.java (added)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/LoggerTest.java Mon Feb 7 01:11:40 2011
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.MarkerManager;
+import org.apache.logging.log4j.ThreadContext;
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.XMLConfigurationFactory;
+import org.apache.logging.log4j.internal.StatusLogger;
+import org.apache.logging.log4j.message.StructuredDataMessage;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ *
+ */
+public class LoggerTest {
+
+ private static final String CONFIG = "log4j-test2.xml";
+
+ @BeforeClass
+ public static void setupClass() {
+ System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
+ LoggerContext ctx = (LoggerContext) LogManager.getContext();
+ Configuration config = ctx.getConfiguration();
+ }
+
+ @AfterClass
+ public static void cleanupClass() {
+ System.clearProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
+ LoggerContext ctx = (LoggerContext) LogManager.getContext();
+ ctx.reconfigure();
+ StatusLogger.getLogger().reset();
+ }
+
+ org.apache.logging.log4j.Logger logger = LogManager.getLogger("LoggerTest");
+
+ @Test
+ public void basicFlow() {
+ logger.entry();
+ logger.exit();
+ }
+
+ @Test
+ public void simpleFlow() {
+ logger.entry(CONFIG);
+ logger.exit(0);
+ }
+
+ @Test
+ public void throwing() {
+ logger.throwing(new IllegalArgumentException("Test Exception"));
+ }
+
+ @Test
+ public void catching() {
+ try {
+ throw new NullPointerException();
+ } catch (Exception e) {
+ logger.catching(e);
+ }
+ }
+
+ @Test
+ public void debug() {
+ logger.debug("Debug message");
+ }
+
+ @Test
+ public void debugObject() {
+ logger.debug(new Date());
+ }
+
+ @Test
+ public void debugWithParms() {
+ logger.debug("Hello, {}", "World");
+ }
+
+ @Test
+ public void mdc() {
+
+ ThreadContext.put("TestYear", new Integer(2010));
+ logger.debug("Debug message");
+ ThreadContext.clear();
+ logger.debug("Debug message");
+ }
+
+ @Test
+ public void structuredData() {
+ ThreadContext.put("loginId", "JohnDoe");
+ ThreadContext.put("ipAddress", "192.168.0.120");
+ ThreadContext.put("locale", Locale.US.getDisplayName());
+ StructuredDataMessage msg = new StructuredDataMessage("Audit@18060", "Transfer Complete", "Transfer");
+ msg.put("ToAccount", "123456");
+ msg.put("FromAccount", "123457");
+ msg.put("Amount", "200.00");
+ logger.info(MarkerManager.getMarker("EVENT"), msg);
+ ThreadContext.clear();
+ }
+}
+
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/filter/MarkerFilterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/filter/MarkerFilterTest.java?rev=1067833&r1=1067832&r2=1067833&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/filter/MarkerFilterTest.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/filter/MarkerFilterTest.java Mon Feb 7 01:11:40 2011
@@ -18,6 +18,7 @@ package org.apache.logging.log4j.core.fi
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.MarkerManager;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.Log4jLogEvent;
import org.apache.logging.log4j.core.LogEvent;
@@ -33,11 +34,11 @@ public class MarkerFilterTest {
@Test
public void testMarkers() {
- Marker parent = Marker.getMarker("Parent");
- Marker child = Marker.getMarker("Child", parent);
- Marker grandChild = Marker.getMarker("GrandChild", child);
- Marker sibling = Marker.getMarker("Sibling", parent);
- Marker stranger = Marker.getMarker("Stranger");
+ Marker parent = MarkerManager.getMarker("Parent");
+ Marker child = MarkerManager.getMarker("Child", parent);
+ Marker grandChild = MarkerManager.getMarker("GrandChild", child);
+ Marker sibling = MarkerManager.getMarker("Sibling", parent);
+ Marker stranger = MarkerManager.getMarker("Stranger");
MarkerFilter filter = MarkerFilter.createFilter("Parent", null, null);
filter.start();
assertTrue(filter.isStarted());
Copied: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-test2.xml (from r1029218, logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-test1.xml)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-test2.xml?p2=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-test2.xml&p1=logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-test1.xml&r1=1029218&r2=1067833&rev=1067833&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-test1.xml (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/resources/log4j-test2.xml Mon Feb 7 01:11:40 2011
@@ -4,12 +4,23 @@
<property name="filename">target/test.log</property>
</properties>
<filters>
- <Threshold level="debug"/>
+ <Threshold level="trace"/>
</filters>
<appenders>
<Console name="STDOUT">
- <PatternLayout pattern="%m%n"/>
+ <PatternLayout pattern="%m MDC%X%n"/>
+ <filters>
+ <Marker marker="FLOW" onMatch="DENY" onMismatch="NEUTRAL"/>
+ <Marker marker="EXCEPTION" onMatch="DENY" onMismatch="ACCEPT"/>
+ </filters>
+ </Console>
+ <Console name="FLOW">
+ <PatternLayout pattern="%C{1}.%M %m %ex%n"/>
+ <filters>
+ <Marker marker="FLOW" onMatch="ACCEPT" onMismatch="NEUTRAL"/>
+ <Marker marker="EXCEPTION" onMatch="ACCEPT" onMismatch="DENY"/>
+ </filters>
</Console>
<File name="File" fileName="${filename}">
<PatternLayout>
@@ -37,8 +48,9 @@
<appender-ref ref="File"/>
</logger>>
- <root level="error">
+ <root level="trace">
<appender-ref ref="STDOUT"/>
+ <appender-ref ref="FLOW"/>
</root>
</loggers>
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/pom.xml?rev=1067833&r1=1067832&r2=1067833&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/pom.xml (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/pom.xml Mon Feb 7 01:11:40 2011
@@ -75,6 +75,39 @@
<name>Apache Software Foundation</name>
<url>http://www.apache.org</url>
</organization>
+ <properties>
+ <slf4j.version>1.6.1</slf4j.version>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-ext</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging</groupId>
+ <artifactId>log4j2-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging</groupId>
+ <artifactId>log4j2-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.3.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<build>
<plugins>
<plugin>
@@ -159,5 +192,6 @@
<module>log4j2-api</module>
<module>log4j12-api</module>
<module>log4j2-core</module>
+ <module>slf4j-impl</module>
</modules>
</project>
Added: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/pom.xml?rev=1067833&view=auto
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/pom.xml (added)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/pom.xml Mon Feb 7 01:11:40 2011
@@ -0,0 +1,90 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.logging</groupId>
+ <artifactId>log4j2-rgoers</artifactId>
+ <version>1.99.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.logging</groupId>
+ <artifactId>slf4j-impl</artifactId>
+ <packaging>jar</packaging>
+ <name>SLF4J Binding</name>
+ <description>Binding between SLF4J API and Log4J2 Core</description>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <tags>
+ <tag>
+ <name>issue</name>
+ <placement>a</placement>
+ <head>JIRA issue:</head>
+ </tag>
+ <tag>
+ <name>doubt</name>
+ <placement>a</placement>
+ <head>Troublesome:</head>
+ </tag>
+ <tag>
+ <name>compare</name>
+ <placement>a</placement>
+ <head>Compare with:</head>
+ </tag>
+ </tags>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-ext</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging</groupId>
+ <artifactId>log4j2-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging</groupId>
+ <artifactId>log4j2-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <distributionManagement>
+ <site>
+ <id>apache.website</id>
+ <url>scp://people.apache.org/home/carnold/public_html/log4j/companions/pattern-layout</url>
+ </site>
+ </distributionManagement>
+
+</project>
+
Added: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/helpers/Log4JLoggerFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/helpers/Log4JLoggerFactory.java?rev=1067833&view=auto
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/helpers/Log4JLoggerFactory.java (added)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/slf4j-impl/src/main/java/org/slf4j/helpers/Log4JLoggerFactory.java Mon Feb 7 01:11:40 2011
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.slf4j.helpers;
+
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.LoggerFactory;
+import org.slf4j.ILoggerFactory;
+import org.slf4j.Logger;
+import org.slf4j.impl.Log4JLogger;
+
+/**
+ *
+ */
+public class Log4JLoggerFactory implements ILoggerFactory {
+
+ private static LoggerContext ctx = new Log4JContext();
+
+ public Logger getLogger(String s) {
+ return (Logger) ctx.getLogger(s);
+ }
+
+ public static LoggerContext getContext() {
+ return ctx;
+ }
+
+ private static class Log4JContext extends LoggerContext {
+
+ private static LoggerFactory loggerFactory = new Factory();
+
+ @Override
+ public org.apache.logging.log4j.core.Logger getLogger(String name) {
+ return getLogger(loggerFactory, name);
+ }
+
+ }
+
+ private static class Factory implements LoggerFactory {
+
+ public org.apache.logging.log4j.core.Logger newInstance(LoggerContext ctx, String name) {
+ return new Log4JLogger(ctx, name);
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org