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/09/07 23:20:36 UTC
svn commit: r1166404 - in
/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j:
./ message/ spi/ status/
Author: rgoers
Date: Wed Sep 7 21:20:34 2011
New Revision: 1166404
URL: http://svn.apache.org/viewvc?rev=1166404&view=rev
Log:
Fix checkstyle errors in api
Modified:
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-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/package-info.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/package-info.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/main/java/org/apache/logging/log4j/spi/AbstractLoggerWrapper.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/LoggerContextFactory.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/LoggerFactory.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/package-info.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusConsoleListener.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusData.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusListener.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/package-info.java
Modified: 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=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/MarkerManager.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/MarkerManager.java Wed Sep 7 21:20:34 2011
@@ -67,6 +67,9 @@ public final class MarkerManager {
return markerMap.get(name);
}
+ /**
+ * The actual Marker implementation.
+ */
private static class Log4JMarker implements Marker {
private static final long serialVersionUID = 100L;
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java Wed Sep 7 21:20:34 2011
@@ -22,7 +22,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -35,8 +34,41 @@ import java.util.Set;
* providing that this attribution remain.
*/
public class ParameterizedMessage implements Message, Serializable {
+
+ /**
+ * Prefix for recursion.
+ */
+ public static final String RECURSION_PREFIX = "[...";
+ /**
+ * Suffix for recursion.
+ */
+ public static final String RECURSION_SUFFIX = "...]";
+
+ /**
+ * Prefix for errors.
+ */
+ public static final String ERROR_PREFIX = "[!!!";
+ /**
+ * Separator for errors.
+ */
+ public static final String ERROR_SEPARATOR = "=>";
+ /**
+ * Separator for error messages.
+ */
+ public static final String ERROR_MSG_SEPARATOR = ":";
+ /**
+ * Suffix for errors.
+ */
+ public static final String ERROR_SUFFIX = "!!!]";
+
private static final long serialVersionUID = -665975803997290697L;
+ private static final int HASHVAL = 31;
+
+ private static final char DELIM_START = '{';
+ private static final char DELIM_STOP = '}';
+ private static final char ESCAPE_CHAR = '\\';
+
private String messagePattern;
private String[] stringArgs;
private transient Object[] argArray;
@@ -69,7 +101,8 @@ public class ParameterizedMessage implem
* <p/>
* <p>If the last argument is a Throwable and is NOT used up by a placeholder in the message pattern it is returned
* in ParameterizedMessage.getThrowable() and won't be contained in the created String[].<br/>
- * If it is used up ParameterizedMessage.getThrowable() will return null even if the last argument was a Throwable!</p>
+ * If it is used up ParameterizedMessage.getThrowable() will return null even if the last argument was a
+ * Throwable!</p>
*
* @param messagePattern the message pattern that to be checked for placeholders.
* @param arguments the argument array to be converted.
@@ -229,22 +262,10 @@ public class ParameterizedMessage implem
public int hashCode() {
int result = messagePattern != null ? messagePattern.hashCode() : 0;
- result = 31 * result + (stringArgs != null ? Arrays.hashCode(stringArgs) : 0);
+ result = HASHVAL * result + (stringArgs != null ? Arrays.hashCode(stringArgs) : 0);
return result;
}
- private static final char DELIM_START = '{';
- private static final char DELIM_STOP = '}';
- private static final char ESCAPE_CHAR = '\\';
-
- public static final String RECURSION_PREFIX = "[...";
- public static final String RECURSION_SUFFIX = "...]";
-
- public static final String ERROR_PREFIX = "[!!!";
- public static final String ERROR_SEPARATOR = "=>";
- public static final String ERROR_MSG_SEPARATOR = ":";
- public static final String ERROR_SUFFIX = "!!!]";
-
/**
* Replace placeholders in the given messagePattern with arguments.
*
@@ -372,7 +393,7 @@ public class ParameterizedMessage implem
return (String) o;
}
StringBuilder str = new StringBuilder();
- Set dejaVu = new HashSet(); // that's actually a neat name ;)
+ Set<String> dejaVu = new HashSet<String>(); // that's actually a neat name ;)
recursiveDeepToString(o, str, dejaVu);
return str.toString();
}
@@ -385,7 +406,8 @@ public class ParameterizedMessage implem
* <p/>
* dejaVu is used in case of those container types to prevent an endless recursion.
* <p/>
- * It should be noted that neither AbstractMap.toString() nor AbstractCollection.toString() implement such a behavior.
+ * It should be noted that neither AbstractMap.toString() nor AbstractCollection.toString() implement such a
+ * behavior.
* They only check if the container is directly contained in itself, but not if a contained container contains the
* original one. Because of that, Arrays.toString(Object[]) isn't safe either.
* Confusing? Just read the last paragraph again and check the respective toString() implementation.
@@ -397,7 +419,7 @@ public class ParameterizedMessage implem
* @param str the StringBuilder that o will be appended to
* @param dejaVu a list of container identities that were already used.
*/
- private static void recursiveDeepToString(Object o, StringBuilder str, Set dejaVu) {
+ private static void recursiveDeepToString(Object o, StringBuilder str, Set<String> dejaVu) {
if (o == null) {
str.append("null");
return;
@@ -435,14 +457,13 @@ public class ParameterizedMessage implem
Object[] oArray = (Object[]) o;
str.append("[");
boolean first = true;
- for (int i = 0; i < oArray.length; ++i) {
- Object current = oArray[i];
+ for (Object current : oArray) {
if (first) {
first = false;
} else {
str.append(", ");
}
- recursiveDeepToString(current, str, new HashSet(dejaVu));
+ recursiveDeepToString(current, str, new HashSet<String>(dejaVu));
}
str.append("]");
}
@@ -458,9 +479,8 @@ public class ParameterizedMessage implem
Map oMap = (Map) o;
str.append("{");
boolean isFirst = true;
- Iterator iter = oMap.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry current = (Map.Entry) iter.next();
+ for (Object o1 : oMap.entrySet()) {
+ Map.Entry current = (Map.Entry) o1;
if (isFirst) {
isFirst = false;
} else {
@@ -468,9 +488,9 @@ public class ParameterizedMessage implem
}
Object key = current.getKey();
Object value = current.getValue();
- recursiveDeepToString(key, str, new HashSet(dejaVu));
+ recursiveDeepToString(key, str, new HashSet<String>(dejaVu));
str.append("=");
- recursiveDeepToString(value, str, new HashSet(dejaVu));
+ recursiveDeepToString(value, str, new HashSet<String>(dejaVu));
}
str.append("}");
}
@@ -484,15 +504,13 @@ public class ParameterizedMessage implem
Collection oCol = (Collection) o;
str.append("[");
boolean isFirst = true;
- Iterator iter = oCol.iterator();
- while (iter.hasNext()) {
- Object current = iter.next();
+ for (Object anOCol : oCol) {
if (isFirst) {
isFirst = false;
} else {
str.append(", ");
}
- recursiveDeepToString(current, str, new HashSet(dejaVu));
+ recursiveDeepToString(anOCol, str, new HashSet<String>(dejaVu));
}
str.append("]");
}
@@ -505,8 +523,7 @@ public class ParameterizedMessage implem
// it's just some other Object, we can only use toString().
try {
str.append(o.toString());
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
str.append(ERROR_PREFIX);
str.append(identityToString(o));
str.append(ERROR_SEPARATOR);
@@ -534,7 +551,8 @@ public class ParameterizedMessage implem
* objects. (This is typically implemented by converting the internal
* address of the object into an integer, but this implementation
* technique is not required by the
- * Java<font size="-2"><sup>TM</sup></font> programming language.)
+ * Java<font size="-2"><sup>TM</sup></font>
+ * programming language.)
*
* @param obj the Object that is to be converted into an identity string.
* @return the identity string as also defined in Object.toString()
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java Wed Sep 7 21:20:34 2011
@@ -22,7 +22,6 @@ import java.io.Serializable;
* The StructuredData identifier.
*/
public class StructuredDataId implements Serializable {
- private static final long serialVersionUID = 9031746276396249990L;
/**
* RFC 5424 Time Quality.
@@ -45,11 +44,14 @@ public class StructuredDataId implements
*/
public static final int RESERVED = -1;
+ private static final long serialVersionUID = 9031746276396249990L;
+ private static final int MAX_LENGTH = 32;
+
private final String name;
private final int enterpriseNumber;
private final String[] required;
private final String[] optional;
- private static final int MAX_LENGTH = 32;
+
protected StructuredDataId(String name, String[] required, String[] optional) {
int index = -1;
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java Wed Sep 7 21:20:34 2011
@@ -27,13 +27,15 @@ import java.util.TreeMap;
* Represents a Message that conforms to RFC 5424 (http://tools.ietf.org/html/rfc5424).
*/
public class StructuredDataMessage implements FormattedMessage, Serializable {
- private static final long serialVersionUID = 1703221292892071920L;
-
/**
* Full message format includes the type and message.
*/
public static final String FULL = "full";
+ private static final long serialVersionUID = 1703221292892071920L;
+ private static final int MAX_LENGTH = 32;
+ private static final int HASHVAL = 31;
+
private Map<String, String> data = new HashMap<String, String>();
private StructuredDataId id;
@@ -44,9 +46,6 @@ public class StructuredDataMessage imple
private String format = null;
- private static final int MAX_LENGTH = 32;
- private static final int HASHVAL = 31;
-
/**
* Constructor based on a String id.
* @param id The String id.
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/package-info.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/package-info.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/package-info.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/package-info.java Wed Sep 7 21:20:34 2011
@@ -1,2 +1,21 @@
-/** Public Message Types used for Log4j 2.0. User's may implement their own Messages. */
-package org.apache.logging.log4j.message;
\ No newline at end of file
+/*
+ * 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.
+ */
+
+/**
+ * Public Message Types used for Log4j 2.0. User's may implement their own Messages.
+ */
+package org.apache.logging.log4j.message;
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/package-info.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/package-info.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/package-info.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/package-info.java Wed Sep 7 21:20:34 2011
@@ -1,2 +1,20 @@
-/** Public API for Log4j 2.0. */
-package org.apache.logging.log4j;
\ No newline at end of file
+/*
+ * 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.
+ */
+/**
+ * Public API for Log4j 2.0.
+ */
+package org.apache.logging.log4j;
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=1166404&r1=1166403&r2=1166404&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 Wed Sep 7 21:20:34 2011
@@ -33,13 +33,30 @@ 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);
+ /**
+ * Marker for flow tracing.
+ */
+ public static final Marker FLOW_MARKER = MarkerManager.getMarker("FLOW");
+ /**
+ * Marker for method entry tracing.
+ */
+ public static final Marker ENTRY_MARKER = MarkerManager.getMarker("ENTRY", FLOW_MARKER);
+ /**
+ * Marker for method exit tracing.
+ */
+ public static final Marker EXIT_MARKER = MarkerManager.getMarker("EXIT", FLOW_MARKER);
+ /**
+ * Marker for exception tracing.
+ */
+ public static final Marker EXCEPTION_MARKER = MarkerManager.getMarker("EXCEPTION");
+ /**
+ * Marker for throwing exceptions.
+ */
+ public static final Marker THROWING_MARKER = MarkerManager.getMarker("THROWING", EXCEPTION_MARKER);
+ /**
+ * Marker for catching exceptions.
+ */
+ public static final Marker CATCHING_MARKER = MarkerManager.getMarker("CATCHING", EXCEPTION_MARKER);
protected String getFQCN() {
return AbstractLogger.class.getName();
@@ -50,7 +67,7 @@ public abstract class AbstractLogger imp
* Log entry to a method.
*/
public void entry() {
- if (isEnabled(Level.TRACE, ENTRY_MARKER, (Object)null, null)) {
+ if (isEnabled(Level.TRACE, ENTRY_MARKER, (Object) null, null)) {
log(ENTRY_MARKER, getFQCN(), Level.TRACE, new SimpleMessage(" entry"), null);
}
}
@@ -62,7 +79,7 @@ public abstract class AbstractLogger imp
* @param params The parameters to the method.
*/
public void entry(Object... params) {
- if (isEnabled(Level.TRACE, ENTRY_MARKER, (Object)null, null)) {
+ if (isEnabled(Level.TRACE, ENTRY_MARKER, (Object) null, null)) {
log(ENTRY_MARKER, getFQCN(), Level.TRACE, entryMsg(params.length, params), null);
}
}
@@ -71,7 +88,7 @@ public abstract class AbstractLogger imp
* Log exit from a method.
*/
public void exit() {
- if (isEnabled(Level.TRACE, EXIT_MARKER, (Object)null, null)) {
+ if (isEnabled(Level.TRACE, EXIT_MARKER, (Object) null, null)) {
log(EXIT_MARKER, getFQCN(), Level.TRACE, exitMsg(null), null);
}
}
@@ -82,7 +99,7 @@ public abstract class AbstractLogger imp
* @param result The result being returned from the method call.
*/
public void exit(Object result) {
- if (isEnabled(Level.TRACE, EXIT_MARKER, (Object)null, null)) {
+ if (isEnabled(Level.TRACE, EXIT_MARKER, (Object) null, null)) {
log(EXIT_MARKER, getFQCN(), Level.TRACE, exitMsg(result), null);
}
}
@@ -93,7 +110,7 @@ public abstract class AbstractLogger imp
* @param t The Throwable.
*/
public void throwing(Throwable t) {
- if (isEnabled(Level.ERROR, THROWING_MARKER, (Object)null, null)) {
+ if (isEnabled(Level.ERROR, THROWING_MARKER, (Object) null, null)) {
log(THROWING_MARKER, getFQCN(), Level.ERROR, new SimpleMessage("throwing"), t);
}
}
@@ -106,7 +123,7 @@ public abstract class AbstractLogger imp
* @param t The Throwable.
*/
public void throwing(Level level, Throwable t) {
- if (isEnabled(level, THROWING_MARKER, (Object)null, null)) {
+ if (isEnabled(level, THROWING_MARKER, (Object) null, null)) {
log(THROWING_MARKER, getFQCN(), level, new SimpleMessage("throwing"), t);
}
}
@@ -117,7 +134,7 @@ public abstract class AbstractLogger imp
* @param t The Throwable.
*/
public void catching(Throwable t) {
- if (isEnabled(Level.DEBUG, THROWING_MARKER, (Object)null, null)) {
+ if (isEnabled(Level.DEBUG, THROWING_MARKER, (Object) null, null)) {
log(THROWING_MARKER, getFQCN(), Level.DEBUG, new SimpleMessage("catching"), t);
}
}
@@ -129,7 +146,7 @@ public abstract class AbstractLogger imp
* @param t The Throwable.
*/
public void catching(Level level, Throwable t) {
- if (isEnabled(level, THROWING_MARKER, (Object)null, null)) {
+ if (isEnabled(level, THROWING_MARKER, (Object) null, null)) {
log(THROWING_MARKER, getFQCN(), level, new SimpleMessage("catching"), t);
}
}
@@ -283,17 +300,18 @@ public abstract class AbstractLogger imp
* TRACE, <code>false</code> otherwise.
*/
public boolean isTraceEnabled() {
- return isEnabled(Level.TRACE, null, (Object)null, null);
+ return isEnabled(Level.TRACE, null, (Object) null, null);
}
/**
* Check whether this Logger is enabled for the TRACE Level.
*
+ * @param marker The marker data.
* @return boolean - <code>true</code> if this Logger is enabled for level
* TRACE, <code>false</code> otherwise.
*/
public boolean isTraceEnabled(Marker marker) {
- return isEnabled(Level.TRACE, marker, (Object)null, null);
+ return isEnabled(Level.TRACE, marker, (Object) null, null);
}
/**
@@ -481,11 +499,12 @@ public abstract class AbstractLogger imp
/**
* Check whether this Logger is enabled for the DEBUG Level.
*
+ * @param marker The marker data.
* @return boolean - <code>true</code> if this Logger is enabled for level
* DEBUG, <code>false</code> otherwise.
*/
public boolean isDebugEnabled(Marker marker) {
- return isEnabled(Level.DEBUG, marker, (Object)null, null);
+ return isEnabled(Level.DEBUG, marker, (Object) null, null);
}
/**
@@ -669,12 +688,12 @@ public abstract class AbstractLogger imp
* INFO, <code>false</code> otherwise.
*/
public boolean isInfoEnabled() {
- return isEnabled(Level.INFO, null, (Object)null, null);
+ return isEnabled(Level.INFO, null, (Object) null, null);
}
/**
* Check whether this Logger is enabled for the INFO Level.
- *
+ * @param marker The marker data.
* @return boolean - <code>true</code> if this Logger is enabled for level
* INFO, <code>false</code> otherwise.
*/
@@ -862,17 +881,18 @@ public abstract class AbstractLogger imp
* WARN, <code>false</code> otherwise.
*/
public boolean isWarnEnabled() {
- return isEnabled(Level.WARN, null, (Object)null, null);
+ return isEnabled(Level.WARN, null, (Object) null, null);
}
/**
* Check whether this Logger is enabled for the WARN Level.
*
+ * @param marker The marker data.
* @return boolean - <code>true</code> if this Logger is enabled for level
* WARN, <code>false</code> otherwise.
*/
public boolean isWarnEnabled(Marker marker) {
- return isEnabled(Level.WARN, marker, (Object)null, null);
+ return isEnabled(Level.WARN, marker, (Object) null, null);
}
/**
@@ -1056,17 +1076,18 @@ public abstract class AbstractLogger imp
* ERROR, <code>false</code> otherwise.
*/
public boolean isErrorEnabled() {
- return isEnabled(Level.ERROR, null, (Object)null, null);
+ return isEnabled(Level.ERROR, null, (Object) null, null);
}
/**
* Check whether this Logger is enabled for the ERROR Level.
*
+ * @param marker The marker data.
* @return boolean - <code>true</code> if this Logger is enabled for level
* ERROR, <code>false</code> otherwise.
*/
public boolean isErrorEnabled(Marker marker) {
- return isEnabled(Level.ERROR, marker, (Object)null, null);
+ return isEnabled(Level.ERROR, marker, (Object) null, null);
}
/**
@@ -1250,17 +1271,18 @@ public abstract class AbstractLogger imp
* FATAL, <code>false</code> otherwise.
*/
public boolean isFatalEnabled() {
- return isEnabled(Level.ERROR, null, (Object)null, null);
+ return isEnabled(Level.ERROR, null, (Object) null, null);
}
/**
* Check whether this Logger is enabled for the FATAL Level.
*
+ * @param marker The marker data.
* @return boolean - <code>true</code> if this Logger is enabled for level
* FATAL, <code>false</code> otherwise.
*/
public boolean isFatalEnabled(Marker marker) {
- return isEnabled(Level.FATAL, marker, (Object)null, null);
+ return isEnabled(Level.FATAL, marker, (Object) null, null);
}
/**
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerWrapper.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/AbstractLoggerWrapper.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerWrapper.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerWrapper.java Wed Sep 7 21:20:34 2011
@@ -25,7 +25,13 @@ import org.apache.logging.log4j.message.
*/
public class AbstractLoggerWrapper extends AbstractLogger {
+ /**
+ * The wrapped Logger.
+ */
protected final AbstractLogger logger;
+ /**
+ * The name of the Logger.
+ */
protected final String name;
/**
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/LoggerContextFactory.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/LoggerContextFactory.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/LoggerContextFactory.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/LoggerContextFactory.java Wed Sep 7 21:20:34 2011
@@ -22,10 +22,10 @@ package org.apache.logging.log4j.spi;
public interface LoggerContextFactory {
/**
- * @param FQCN The fully qualified class name of the caller.
+ * @param fqcn The fully qualified class name of the caller.
* @param currentContext If true returns the current Context, if false returns the Context appropriate
* for the caller if a more appropriate Context can be determined.
* @return The LoggerContext.
*/
- LoggerContext getContext(String FQCN, boolean currentContext);
+ LoggerContext getContext(String fqcn, boolean currentContext);
}
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/LoggerFactory.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/LoggerFactory.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/LoggerFactory.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/LoggerFactory.java Wed Sep 7 21:20:34 2011
@@ -20,6 +20,7 @@ import org.apache.logging.log4j.Logger;
/**
* Interface implemented by factories that create Logger objects.
+ * @param <C> The LoogerContext class.
*/
public interface LoggerFactory<C extends LoggerContext> {
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/package-info.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/package-info.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/package-info.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/spi/package-info.java Wed Sep 7 21:20:34 2011
@@ -1,2 +1,20 @@
-/** Internal interfaces and classes to be used by authors of logging implementations. */
-package org.apache.logging.log4j.spi;
\ No newline at end of file
+/*
+ * 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.
+ */
+/**
+ * Internal interfaces and classes to be used by authors of logging implementations.
+ */
+package org.apache.logging.log4j.spi;
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusConsoleListener.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusConsoleListener.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusConsoleListener.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusConsoleListener.java Wed Sep 7 21:20:34 2011
@@ -19,7 +19,7 @@ package org.apache.logging.log4j.status;
import org.apache.logging.log4j.Level;
/**
- * StatusListener that writes to the Console
+ * StatusListener that writes to the Console.
*/
public class StatusConsoleListener implements StatusListener {
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusData.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusData.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusData.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusData.java Wed Sep 7 21:20:34 2011
@@ -108,7 +108,7 @@ public class StatusData {
sb.append(msg.getFormattedMessage());
Object[] params = msg.getParameters();
Throwable t;
- if (throwable == null && params != null && params[params.length -1] instanceof Throwable ) {
+ if (throwable == null && params != null && params[params.length - 1] instanceof Throwable) {
t = (Throwable) params[params.length - 1];
} else {
t = throwable;
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusListener.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusListener.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusListener.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusListener.java Wed Sep 7 21:20:34 2011
@@ -1,3 +1,19 @@
+/*
+ * 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.status;
/**
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java Wed Sep 7 21:20:34 2011
@@ -34,9 +34,7 @@ import java.util.concurrent.locks.Reentr
/**
* Mechanism to record events that occur in the logging system.
*/
-public class StatusLogger extends AbstractLogger {
-
- private static final String NOT_AVAIL = "?";
+public final class StatusLogger extends AbstractLogger {
/**
* System property that can be configured with the number of entries in the queue. Once the limit
@@ -44,7 +42,9 @@ public class StatusLogger extends Abstra
*/
public static final String MAX_STATUS_ENTRIES = "log4j2.status.entries";
- private static final int maxEntries = Integer.getInteger(MAX_STATUS_ENTRIES, 200);
+ private static final String NOT_AVAIL = "?";
+
+ private static final int MAX_ENTRIES = Integer.getInteger(MAX_STATUS_ENTRIES, 200);
// private static final String FQCN = AbstractLogger.class.getName();
@@ -55,7 +55,7 @@ public class StatusLogger extends Abstra
private CopyOnWriteArrayList<StatusListener> listeners = new CopyOnWriteArrayList<StatusListener>();
private ReentrantReadWriteLock listenersLock = new ReentrantReadWriteLock();
- private Queue<StatusData> messages = new BoundedQueue<StatusData>(maxEntries);
+ private Queue<StatusData> messages = new BoundedQueue<StatusData>(MAX_ENTRIES);
private ReentrantLock msgLock = new ReentrantLock();
private StatusLogger() {
@@ -244,6 +244,10 @@ public class StatusLogger extends Abstra
return false;
}
+ /**
+ * Queue for status events.
+ * @param <E> Object type to be stored in the queue.
+ */
private class BoundedQueue<E> extends ConcurrentLinkedQueue<E> {
private final int size;
@@ -253,7 +257,7 @@ public class StatusLogger extends Abstra
}
public boolean add(E object) {
- while (messages.size() > maxEntries) {
+ while (messages.size() > size) {
messages.poll();
}
return super.add(object);
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/package-info.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/package-info.java?rev=1166404&r1=1166403&r2=1166404&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/package-info.java (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/status/package-info.java Wed Sep 7 21:20:34 2011
@@ -1,4 +1,21 @@
+/*
+ * 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.
+ */
+
/** Status API for Log4j 2.0. Should not be used by typical applications performing logging but may be
* used by applications reporting on the status of the logging system
*/
-package org.apache.logging.log4j.status;
\ No newline at end of file
+package org.apache.logging.log4j.status;