Author: carnold
Date: Tue Jun 1 04:30:40 2010
New Revision: 949925
URL: http://svn.apache.org/viewvc?rev=949925&view=rev
Log:
Replace Filter.getLowerLimit/Upper with getThreshold
Added:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/UnrecoverableLoggingException.java
Removed:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/log4j2-core.iml
Modified:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/AcceptAllFilter.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/ChainedFilter.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/DenyAllFilter.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/Filter.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/LevelRangeFilter.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/LoggingException.java
Modified:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/AcceptAllFilter.java
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/AcceptAllFilter.java?rev=949925&r1=949924&r2=949925&view=diff
==============================================================================
---
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/AcceptAllFilter.java
(original)
+++
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/AcceptAllFilter.java
Tue Jun 1 04:30:40 2010
@@ -63,14 +63,7 @@ public final class AcceptAllFilter imple
/**
* {...@inheritdoc}
*/
- public int getLowerLimit() {
+ public int getThreshold() {
return Integer.MIN_VALUE;
}
- /**
- * {...@inheritdoc}
- */
- public int getUpperLimit() {
- return Integer.MIN_VALUE;
- }
-
}
Modified:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/ChainedFilter.java
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/ChainedFilter.java?rev=949925&r1=949924&r2=949925&view=diff
==============================================================================
---
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/ChainedFilter.java
(original)
+++
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/ChainedFilter.java
Tue Jun 1 04:30:40 2010
@@ -25,8 +25,7 @@ package org.apache.logging.core;
public final class ChainedFilter implements Filter {
private final Filter head;
private final Filter tail;
- private final int lowerLimit;
- private final int upperLimit;
+ private final int threshold;
public ChainedFilter(Filter head, Filter tail) {
if(head == null || tail == null) {
@@ -34,64 +33,69 @@ public final class ChainedFilter impleme
}
this.head = head;
this.tail = tail;
- lowerLimit = Math.min(head.getLowerLimit(), tail.getLowerLimit());
- upperLimit = Math.max(head.getUpperLimit(), tail.getUpperLimit());
+ threshold = Math.min(head.getThreshold(), tail.getThreshold());
}
/**
* {...@inheritdoc}
*/
public Result filter(Level level) {
- Result headResult = head.filter(level);
- if(headResult != Filter.Result.NEUTRAL) {
- return headResult;
+ if(level == null || level.getGenericValue() >= threshold) {
+ Result headResult = head.filter(level);
+ if(headResult != Filter.Result.NEUTRAL) {
+ return headResult;
+ }
+ return tail.filter(level);
}
- return tail.filter(level);
+ return Result.DENY;
}
/**
* {...@inheritdoc}
*/
public Result filter(Level level, Object userContext) {
- Result headResult = head.filter(level, userContext);
- if(headResult != Filter.Result.NEUTRAL) {
- return headResult;
+ if(level == null || level.getGenericValue() >= threshold) {
+ Result headResult = head.filter(level, userContext);
+ if(headResult != Filter.Result.NEUTRAL) {
+ return headResult;
+ }
+ return tail.filter(level, userContext);
}
- return tail.filter(level, userContext);
+ return Result.DENY;
}
/**
* {...@inheritdoc}
*/
public Result filter(Level level, Object userContext, Object message) {
- Result headResult = head.filter(level, userContext, message);
- if(headResult != Filter.Result.NEUTRAL) {
- return headResult;
+ if(level == null || level.getGenericValue() >= threshold)
+ {
+ Result headResult = head.filter(level, userContext, message);
+ if(headResult != Filter.Result.NEUTRAL) {
+ return headResult;
+ }
+ return tail.filter(level, userContext, message);
}
- return tail.filter(level, userContext, message);
+ return Result.DENY;
}
/**
* {...@inheritdoc}
*/
public Result filter(LogEvent event) {
- Result headResult = head.filter(event);
- if(headResult != Filter.Result.NEUTRAL) {
- return headResult;
- }
- return tail.filter(event);
-
+ final Level level = event.getLevel();
+ if(level == null || level.getGenericValue() >= threshold) {
+ Result headResult = head.filter(event);
+ if(headResult != Filter.Result.NEUTRAL) {
+ return headResult;
+ }
+ return tail.filter(event);
+ }
+ return Result.DENY;
}
/**
* {...@inheritdoc}
*/
- public int getLowerLimit() {
- return lowerLimit;
- }
- /**
- * {...@inheritdoc}
- */
- public int getUpperLimit() {
- return upperLimit;
+ public int getThreshold() {
+ return threshold;
}
-
}
Modified:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/DenyAllFilter.java
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/DenyAllFilter.java?rev=949925&r1=949924&r2=949925&view=diff
==============================================================================
---
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/DenyAllFilter.java
(original)
+++
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/DenyAllFilter.java
Tue Jun 1 04:30:40 2010
@@ -56,14 +56,7 @@ public final class DenyAllFilter impleme
/**
* {...@inheritdoc}
*/
- public int getLowerLimit() {
+ public int getThreshold() {
return Integer.MAX_VALUE;
}
- /**
- * {...@inheritdoc}
- */
- public int getUpperLimit() {
- return Integer.MAX_VALUE;
- }
-
}
Modified:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/Filter.java
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/Filter.java?rev=949925&r1=949924&r2=949925&view=diff
==============================================================================
---
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/Filter.java
(original)
+++
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/Filter.java
Tue Jun 1 04:30:40 2010
@@ -84,12 +84,5 @@ public interface Filter {
* This method allows for level calculus to determine composite threshold.
* @return lowest level that could result in something other than DENY.
*/
- int getLowerLimit();
- /**
- * Generic level value above which filter will always return PASS.
- * Set to Integer.MAX_VALUE if does not consider level.
- * This method allows for level calculus to determine composite threshold.
- * @return highest level that could result in something other than PASS.
- */
- int getUpperLimit();
+ int getThreshold();
}
Modified:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/LevelRangeFilter.java
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/LevelRangeFilter.java?rev=949925&r1=949924&r2=949925&view=diff
==============================================================================
---
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/LevelRangeFilter.java
(original)
+++
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/LevelRangeFilter.java
Tue Jun 1 04:30:40 2010
@@ -94,14 +94,7 @@ public final class LevelRangeFilter impl
/**
* {...@inheritdoc}
*/
- public int getLowerLimit() {
+ public int getThreshold() {
return levelMin;
}
- /**
- * {...@inheritdoc}
- */
- public int getUpperLimit() {
- return Integer.MAX_VALUE;
- }
-
}
Modified:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/LoggingException.java
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/LoggingException.java?rev=949925&r1=949924&r2=949925&view=diff
==============================================================================
---
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/LoggingException.java
(original)
+++
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/LoggingException.java
Tue Jun 1 04:30:40 2010
@@ -16,10 +16,6 @@
*/
package org.apache.logging.core;
-import java.util.logging.*;
-
-import org.apache.log4j.*;
-
/**
*
*
@@ -27,4 +23,16 @@ import org.apache.log4j.*;
*
*/
public class LoggingException extends Exception {
+ public LoggingException() {
+ super();
+ }
+ public LoggingException(String message) {
+ super(message);
+ }
+ public LoggingException(String message,Throwable cause) {
+ super(message,cause);
+ }
+ public LoggingException(Throwable cause) {
+ super(cause);
+ }
}
Added:
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/UnrecoverableLoggingException.java
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/UnrecoverableLoggingException.java?rev=949925&view=auto
==============================================================================
---
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/UnrecoverableLoggingException.java
(added)
+++
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/carnold/log4j2-api/src/main/java/org/apache/logging/core/UnrecoverableLoggingException.java
Tue Jun 1 04:30:40 2010
@@ -0,0 +1,38 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.apache.logging.core;
+
+/**
+ *
+ */
+public class UnrecoverableLoggingException extends LoggingException {
+ private final Object failedComponent;
+ public UnrecoverableLoggingException(final Object failedComponent) {
+ this(failedComponent, null, null);
+ }
+ public UnrecoverableLoggingException(final Object failedComponent,
+ final String message) {
+ this(failedComponent, message, null);
+ }
+ public UnrecoverableLoggingException(final Object failedComponent,
+ final String message,
+ final Throwable cause) {
+ super(message,cause);
+ if (failedComponent == null) {
+ throw new NullPointerException();
+ }
+ this.failedComponent = failedComponent;
+ }
+ public UnrecoverableLoggingException(final Object failedComponent,
+ final Throwable cause) {
+ this(failedComponent, null, cause);
+ }
+
+ public final Object getFailedComponent() {
+ return failedComponent;
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]