You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2011/12/28 08:50:17 UTC
svn commit: r1225138 [2/2] - in
/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core:
appender/rolling/helper/ appender/routing/ config/ config/plugins/ filter/
helpers/
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/RegexFilter.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/RegexFilter.java?rev=1225138&r1=1225137&r2=1225138&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/RegexFilter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/RegexFilter.java Wed Dec 28 07:50:16 2011
@@ -98,7 +98,7 @@ public final class RegexFilter extends F
@PluginAttr("onMismatch") String mismatch) {
if (regex == null) {
- logger.error("A regular expression must be provided for RegexFilter");
+ LOGGER.error("A regular expression must be provided for RegexFilter");
return null;
}
boolean raw = useRawMsg == null ? false : Boolean.parseBoolean(useRawMsg);
@@ -106,7 +106,7 @@ public final class RegexFilter extends F
try {
pattern = Pattern.compile(regex);
} catch (Exception ex) {
- logger.error("RegexFilter caught exception compiling pattern: " + regex + " cause: " + ex.getMessage());
+ LOGGER.error("RegexFilter caught exception compiling pattern: " + regex + " cause: " + ex.getMessage());
return null;
}
Result onMatch = match == null ? null : Result.valueOf(match);
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/StructuredDataFilter.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/StructuredDataFilter.java?rev=1225138&r1=1225137&r2=1225138&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/StructuredDataFilter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/StructuredDataFilter.java Wed Dec 28 07:50:16 2011
@@ -44,7 +44,7 @@ public final class StructuredDataFilter
@Override
public Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t) {
if (msg instanceof StructuredDataMessage) {
- return filter((StructuredDataMessage)msg);
+ return filter((StructuredDataMessage) msg);
}
return Result.NEUTRAL;
}
@@ -118,25 +118,25 @@ public final class StructuredDataFilter
@PluginAttr("onmatch") String match,
@PluginAttr("onmismatch") String mismatch) {
if (pairs == null || pairs.length == 0) {
- logger.error("keys and values must be specified for the StructuredDataFilter");
+ LOGGER.error("keys and values must be specified for the StructuredDataFilter");
return null;
}
Map<String, String> map = new HashMap<String, String>();
for (KeyValuePair pair : pairs) {
String key = pair.getKey();
if (key == null) {
- logger.error("A null key is not valid in StructuredDataFilter");
+ LOGGER.error("A null key is not valid in StructuredDataFilter");
continue;
}
String value = pair.getValue();
if (value == null) {
- logger.error("A null value for key " + key + " is not allowed in StructuredDataFilter");
+ LOGGER.error("A null value for key " + key + " is not allowed in StructuredDataFilter");
continue;
}
map.put(pair.getKey(), pair.getValue());
}
if (map.size() == 0) {
- logger.error("StructuredDataFilter is not configured with any valid key value pairs");
+ LOGGER.error("StructuredDataFilter is not configured with any valid key value pairs");
return null;
}
boolean isAnd = oper == null || !oper.equalsIgnoreCase("or");
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.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/ThreadContextMapFilter.java?rev=1225138&r1=1225137&r2=1225138&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java Wed Dec 28 07:50:16 2011
@@ -33,9 +33,9 @@ import java.util.Iterator;
import java.util.Map;
/**
- *
+ * Filter based on a value in the Thread Context Map (MDC).
*/
-@Plugin(name="ThreadContextMapFilter", type="Core", elementType="filter", printObject = true)
+@Plugin(name = "ThreadContextMapFilter", type = "Core", elementType = "filter", printObject = true)
public class ThreadContextMapFilter extends FilterBase {
private final Map<String, String> map;
@@ -52,7 +52,7 @@ public class ThreadContextMapFilter exte
Iterator<Map.Entry<String, String>> iter = pairs.entrySet().iterator();
Map.Entry<String, String> entry = iter.next();
this.key = entry.getKey();
- this.value= entry.getValue();
+ this.value = entry.getValue();
this.map = null;
this.isAnd = false;
this.useMap = false;
@@ -136,25 +136,25 @@ public class ThreadContextMapFilter exte
@PluginAttr("onmatch") String match,
@PluginAttr("onmismatch") String mismatch) {
if (pairs == null || pairs.length == 0) {
- logger.error("key and value pairs must be specified for the ThreadContextMapFilter");
+ LOGGER.error("key and value pairs must be specified for the ThreadContextMapFilter");
return null;
}
Map<String, String> map = new HashMap<String, String>();
for (KeyValuePair pair : pairs) {
String key = pair.getKey();
if (key == null) {
- logger.error("A null key is not valid in ThreadContextMapFilter");
+ LOGGER.error("A null key is not valid in ThreadContextMapFilter");
continue;
}
String value = pair.getValue();
if (value == null) {
- logger.error("A null value for key " + key + " is not allowed in ThreadContextMapFilter");
+ LOGGER.error("A null value for key " + key + " is not allowed in ThreadContextMapFilter");
continue;
}
map.put(pair.getKey(), pair.getValue());
}
if (map.size() == 0) {
- logger.error("ThreadContextMapFilter is not configured with any valid key value pairs");
+ LOGGER.error("ThreadContextMapFilter is not configured with any valid key value pairs");
return null;
}
boolean isAnd = oper == null || !oper.equalsIgnoreCase("or");
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/TimeFilter.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/TimeFilter.java?rev=1225138&r1=1225137&r2=1225138&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/TimeFilter.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/TimeFilter.java Wed Dec 28 07:50:16 2011
@@ -112,8 +112,8 @@ public final class TimeFilter extends Fi
stf.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
s = stf.parse(start).getTime();
- } catch(ParseException ex) {
- logger.warn("Error parsing start value " + start, ex);
+ } catch (ParseException ex) {
+ LOGGER.warn("Error parsing start value " + start, ex);
}
}
long e = Long.MAX_VALUE;
@@ -121,8 +121,8 @@ public final class TimeFilter extends Fi
stf.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
e = stf.parse(end).getTime();
- } catch(ParseException ex) {
- logger.warn("Error parsing start value " + end, ex);
+ } catch (ParseException ex) {
+ LOGGER.warn("Error parsing start value " + end, ex);
}
}
TimeZone timezone = (tz == null) ? TimeZone.getDefault() : TimeZone.getTimeZone(tz);
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ValueLevelPair.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/ValueLevelPair.java?rev=1225138&r1=1225137&r2=1225138&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ValueLevelPair.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ValueLevelPair.java Wed Dec 28 07:50:16 2011
@@ -44,7 +44,7 @@ public class ValueLevelPair {
}
/**
- * Create a Value/Level pair using the Log Levels
+ * Create a Value/Level pair using the Log Levels.
* @param key The key.
* @param value Its value.
* @return A ValueLevelPair.
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/Constants.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/helpers/Constants.java?rev=1225138&r1=1225137&r2=1225138&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/Constants.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/Constants.java Wed Dec 28 07:50:16 2011
@@ -17,10 +17,13 @@
package org.apache.logging.log4j.core.helpers;
/**
- *
+ * Log4j Constants.
*/
public final class Constants {
+ /**
+ * Name of the system property to use to identify the ContextSelector Class.
+ */
public static final String LOG4J_CONTEXT_SELECTOR = "Log4jContextSelector";
/**
@@ -31,5 +34,6 @@ public final class Constants {
/**
* Prevent class instantiation.
*/
- private Constants() {};
+ private Constants() {
+ }
}
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/FileUtils.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/helpers/FileUtils.java?rev=1225138&r1=1225137&r2=1225138&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/FileUtils.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/FileUtils.java Wed Dec 28 07:50:16 2011
@@ -26,11 +26,10 @@ import java.net.URI;
import java.net.URLDecoder;
/**
- *
+ * File utilities.
*/
public final class FileUtils {
-
/** Constant for the file URL protocol.*/
private static final String PROTOCOL_FILE = "file";
@@ -46,14 +45,10 @@ public final class FileUtils {
* @param uri the URI
* @return the resulting file object
*/
- public static File fileFromURI(URI uri)
- {
- if (uri == null || !uri.getScheme().equals(PROTOCOL_FILE))
- {
+ public static File fileFromURI(URI uri) {
+ if (uri == null || !uri.getScheme().equals(PROTOCOL_FILE)) {
return null;
- }
- else
- {
+ } else {
try {
return new File(URLDecoder.decode(uri.toURL().getFile(), "UTF8"));
} catch (MalformedURLException ex) {
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/KeyValuePair.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/helpers/KeyValuePair.java?rev=1225138&r1=1225137&r2=1225138&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/KeyValuePair.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/KeyValuePair.java Wed Dec 28 07:50:16 2011
@@ -21,31 +21,51 @@ import org.apache.logging.log4j.core.con
import org.apache.logging.log4j.core.config.plugins.PluginFactory;
/**
- *
+ * Key/Value pair configuration item.
*/
-@Plugin(name="KeyValuePair", type="Core", printObject=true)
+@Plugin(name = "KeyValuePair", type = "Core", printObject = true)
public class KeyValuePair {
private final String key;
private final String value;
+ /**
+ * Constructs a key/value pair. The constructor should only be called from test classes.
+ * @param key The key.
+ * @param value The value.
+ */
public KeyValuePair(String key, String value) {
this.key = key;
this.value = value;
}
+ /**
+ * Return the key.
+ * @return the key.
+ */
public String getKey() {
return key;
}
+ /**
+ * Return the value.
+ * @return The value.
+ */
public String getValue() {
return value;
}
+ @Override
public String toString() {
return key + "=" + value;
}
+ /**
+ * Create a Key/Value pair.
+ * @param key The key.
+ * @param value The value.
+ * @return A KeyValuePair.
+ */
@PluginFactory
public static KeyValuePair createPair(@PluginAttr("key") String key,
@PluginAttr("value") String value) {