You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2015/09/24 10:50:54 UTC
[01/35] logging-log4j2 git commit: Checkstyle: Variable access
definition in wrong order.
Repository: logging-log4j2
Updated Branches:
refs/heads/master 47f70fee5 -> d64ec4481
Checkstyle: Variable access definition in wrong order.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/74aa89ab
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/74aa89ab
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/74aa89ab
Branch: refs/heads/master
Commit: 74aa89aba206eafdd9fea1c7ae5985a477ab4c13
Parents: 2a4479b
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 08:29:57 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 08:29:57 2015 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/logging/log4j/EventLogger.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/74aa89ab/log4j-api/src/main/java/org/apache/logging/log4j/EventLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/EventLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/EventLogger.java
index f39070f..364b640 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/EventLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/EventLogger.java
@@ -24,13 +24,13 @@ import org.apache.logging.log4j.spi.ExtendedLogger;
*/
public final class EventLogger {
- private static final String NAME = "EventLogger";
-
/**
* Defines the Event Marker.
*/
public static final Marker EVENT_MARKER = MarkerManager.getMarker("EVENT");
+ private static final String NAME = "EventLogger";
+
private static final String FQCN = EventLogger.class.getName();
private static final ExtendedLogger LOGGER = LogManager.getContext(false).getLogger(NAME);
[14/35] logging-log4j2 git commit: Checkstyle: 'level' hides field,
FileTabCharacter, LineLength, trailing space. IDE autoformatted.
Posted by rp...@apache.org.
Checkstyle: 'level' hides field, FileTabCharacter, LineLength, trailing
space. IDE autoformatted.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/20e5e9c5
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/20e5e9c5
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/20e5e9c5
Branch: refs/heads/master
Commit: 20e5e9c529ac332e8496833d57b71ff42f67c61f
Parents: 111ea36
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:13:40 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:13:40 2015 +0200
----------------------------------------------------------------------
.../apache/logging/log4j/simple/SimpleLogger.java | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20e5e9c5/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java
index 12699ce..b633ef9 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java
@@ -32,7 +32,7 @@ import org.apache.logging.log4j.util.PropertiesUtil;
import org.apache.logging.log4j.util.Strings;
/**
- * This is the default logger that is used when no suitable logging implementation is available.
+ * This is the default logger that is used when no suitable logging implementation is available.
*/
public class SimpleLogger extends AbstractLogger {
@@ -40,7 +40,7 @@ public class SimpleLogger extends AbstractLogger {
private static final char SPACE = ' ';
- /**
+ /**
* Used to format times.
* <p>
* Note that DateFormat is not Thread-safe.
@@ -58,11 +58,10 @@ public class SimpleLogger extends AbstractLogger {
private final String logName;
-
public SimpleLogger(final String name, final Level defaultLevel, final boolean showLogName,
- final boolean showShortLogName, final boolean showDateTime, final boolean showContextMap,
- final String dateTimeFormat, final MessageFactory messageFactory, final PropertiesUtil props,
- final PrintStream stream) {
+ final boolean showShortLogName, final boolean showDateTime, final boolean showContextMap,
+ final String dateTimeFormat, final MessageFactory messageFactory, final PropertiesUtil props,
+ final PrintStream stream) {
super(name, messageFactory);
final String lvl = props.getStringProperty(SimpleLoggerContext.SYSTEM_PREFIX + name + ".level");
this.level = Level.toLevel(lvl, defaultLevel);
@@ -76,7 +75,7 @@ public class SimpleLogger extends AbstractLogger {
} else if (showLogName) {
this.logName = name;
} else {
- this.logName = null;
+ this.logName = null;
}
this.showDateTime = showDateTime;
this.showContextMap = showContextMap;
@@ -123,7 +122,7 @@ public class SimpleLogger extends AbstractLogger {
}
@Override
- public void logMessage(final String fqcn, final Level level, final Marker marker, final Message msg,
+ public void logMessage(final String fqcn, final Level mgsLevel, final Marker marker, final Message msg,
final Throwable throwable) {
final StringBuilder sb = new StringBuilder();
// Append date-time if so configured
@@ -137,7 +136,7 @@ public class SimpleLogger extends AbstractLogger {
sb.append(SPACE);
}
- sb.append(level.toString());
+ sb.append(mgsLevel.toString());
sb.append(SPACE);
if (Strings.isNotEmpty(logName)) {
sb.append(logName);
[29/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
whitespace around '{', javadoc, IDE autoformatted
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, whitespace around '{', javadoc, IDE
autoformatted
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/18f821c5
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/18f821c5
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/18f821c5
Branch: refs/heads/master
Commit: 18f821c574b2bedad81abc5b1cb4b558ec07f7ba
Parents: 54a7d2f
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:58:29 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:58:29 2015 +0200
----------------------------------------------------------------------
.../apache/logging/log4j/util/LoaderUtil.java | 48 ++++++++++----------
1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/18f821c5/log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java
index 8f68500..4624d0b 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java
@@ -27,13 +27,13 @@ import java.util.LinkedHashSet;
/**
* <em>Consider this class private.</em> Utility class for ClassLoaders.
+ *
* @see ClassLoader
* @see RuntimePermission
* @see Thread#getContextClassLoader()
* @see ClassLoader#getSystemClassLoader()
*/
public final class LoaderUtil {
- private LoaderUtil() {}
/**
* System property to set to ignore the thread context ClassLoader.
@@ -67,11 +67,14 @@ public final class LoaderUtil {
}
}
+ private LoaderUtil() {
+ }
+
/**
- * Gets the current Thread ClassLoader. Returns the system ClassLoader if the TCCL is {@code null}. If the
- * system ClassLoader is {@code null} as well, then the ClassLoader for this class is returned.
- * If running with a {@link SecurityManager} that does not allow access to the Thread ClassLoader or system
- * ClassLoader, then the ClassLoader for this class is returned.
+ * Gets the current Thread ClassLoader. Returns the system ClassLoader if the TCCL is {@code null}. If the system
+ * ClassLoader is {@code null} as well, then the ClassLoader for this class is returned. If running with a
+ * {@link SecurityManager} that does not allow access to the Thread ClassLoader or system ClassLoader, then the
+ * ClassLoader for this class is returned.
*
* @return the current ThreadContextClassLoader.
*/
@@ -81,11 +84,12 @@ public final class LoaderUtil {
// however, if this is null, there's really no option left at this point
return LoaderUtil.class.getClassLoader();
}
- return SECURITY_MANAGER == null
- ? TCCL_GETTER.run()
- : AccessController.doPrivileged(TCCL_GETTER);
+ return SECURITY_MANAGER == null ? TCCL_GETTER.run() : AccessController.doPrivileged(TCCL_GETTER);
}
+ /**
+ *
+ */
private static class ThreadContextClassLoaderGetter implements PrivilegedAction<ClassLoader> {
@Override
public ClassLoader run() {
@@ -99,8 +103,8 @@ public final class LoaderUtil {
}
/**
- * Loads a class by name. This method respects the {@link #IGNORE_TCCL_PROPERTY} Log4j property. If this property
- * is specified and set to anything besides {@code false}, then the default ClassLoader will be used.
+ * Loads a class by name. This method respects the {@link #IGNORE_TCCL_PROPERTY} Log4j property. If this property is
+ * specified and set to anything besides {@code false}, then the default ClassLoader will be used.
*
* @param className The class name.
* @return the Class for the given name.
@@ -123,16 +127,15 @@ public final class LoaderUtil {
*
* @param className The class name.
* @return new instance of the class.
- * @throws ClassNotFoundException if the class isn't available to the usual ClassLoaders
- * @throws IllegalAccessException if the class can't be instantiated through a public constructor
- * @throws InstantiationException if there was an exception whilst instantiating the class
- * @throws NoSuchMethodException if there isn't a no-args constructor on the class
+ * @throws ClassNotFoundException if the class isn't available to the usual ClassLoaders
+ * @throws IllegalAccessException if the class can't be instantiated through a public constructor
+ * @throws InstantiationException if there was an exception whilst instantiating the class
+ * @throws NoSuchMethodException if there isn't a no-args constructor on the class
* @throws InvocationTargetException if there was an exception whilst constructing the class
* @since 2.1
*/
- public static Object newInstanceOf(final String className)
- throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException,
- InvocationTargetException {
+ public static Object newInstanceOf(final String className) throws ClassNotFoundException, IllegalAccessException,
+ InstantiationException, NoSuchMethodException, InvocationTargetException {
final Class<?> clazz = loadClass(className);
try {
return clazz.getConstructor().newInstance();
@@ -158,8 +161,8 @@ public final class LoaderUtil {
* @since 2.1
*/
public static <T> T newCheckedInstanceOf(final String className, final Class<T> clazz)
- throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException,
- IllegalAccessException {
+ throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException,
+ IllegalAccessException {
return clazz.cast(newInstanceOf(className));
}
@@ -189,11 +192,8 @@ public final class LoaderUtil {
}
static Collection<UrlResource> findUrlResources(final String resource) {
- final ClassLoader[] candidates = {
- getThreadContextClassLoader(),
- LoaderUtil.class.getClassLoader(),
- GET_CLASS_LOADER_DISABLED ? null : ClassLoader.getSystemClassLoader()
- };
+ final ClassLoader[] candidates = { getThreadContextClassLoader(), LoaderUtil.class.getClassLoader(),
+ GET_CLASS_LOADER_DISABLED ? null : ClassLoader.getSystemClassLoader() };
final Collection<UrlResource> resources = new LinkedHashSet<>();
for (final ClassLoader cl : candidates) {
if (cl != null) {
[33/35] logging-log4j2 git commit: Checkstyle: util class should have
private constructor, IDE autoformat
Posted by rp...@apache.org.
Checkstyle: util class should have private constructor, IDE autoformat
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7de6fc0a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7de6fc0a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7de6fc0a
Branch: refs/heads/master
Commit: 7de6fc0a2dc2ff5f871f42dd28e9550745ccefad
Parents: 4b3296c
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 10:43:22 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 10:43:22 2015 +0200
----------------------------------------------------------------------
.../logging/log4j/util/StringBuilders.java | 23 ++++++++------------
1 file changed, 9 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7de6fc0a/log4j-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java
index f6b11d6..0eb1ea2 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java
@@ -22,14 +22,14 @@ import java.util.Map.Entry;
* <em>Consider this class private.</em>
*/
public class StringBuilders {
+ private StringBuilders() {
+ }
/**
* Appends in the following format: double quoted value.
*
- * @param sb
- * a string builder
- * @param value
- * a value
+ * @param sb a string builder
+ * @param value a value
* @return {@code "value"}
*/
public static StringBuilder appendDqValue(final StringBuilder sb, final Object value) {
@@ -39,10 +39,8 @@ public class StringBuilders {
/**
* Appends in the following format: key=double quoted value.
*
- * @param sb
- * a string builder
- * @param entry
- * a map entry
+ * @param sb a string builder
+ * @param entry a map entry
* @return {@code key="value"}
*/
public static StringBuilder appendKeyDqValue(final StringBuilder sb, final Entry<String, String> entry) {
@@ -52,12 +50,9 @@ public class StringBuilders {
/**
* Appends in the following format: key=double quoted value.
*
- * @param sb
- * a string builder
- * @param key
- * a key
- * @param value
- * a value
+ * @param sb a string builder
+ * @param key a key
+ * @param value a value
* @return {@code key="value"}
*/
public static StringBuilder appendKeyDqValue(final StringBuilder sb, final String key, final Object value) {
[08/35] logging-log4j2 git commit: Checkstyle: 'throwable' hides field
Posted by rp...@apache.org.
Checkstyle: 'throwable' hides field
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8dcd64c5
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8dcd64c5
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8dcd64c5
Branch: refs/heads/master
Commit: 8dcd64c5fc08a6854777dc9ad9cf0baf86c35580
Parents: 4432ec2
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:02:19 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:02:19 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/message/FormattedMessage.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8dcd64c5/log4j-api/src/main/java/org/apache/logging/log4j/message/FormattedMessage.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/FormattedMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/FormattedMessage.java
index 54905d0..39019d0 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/FormattedMessage.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/FormattedMessage.java
@@ -108,7 +108,7 @@ public class FormattedMessage implements Message {
return stringArgs;
}
- protected Message getMessage(final String msgPattern, final Object[] args, final Throwable throwable) {
+ protected Message getMessage(final String msgPattern, final Object[] args, final Throwable aThrowable) {
try {
final MessageFormat format = new MessageFormat(msgPattern);
final Format[] formats = format.getFormats();
@@ -125,7 +125,7 @@ public class FormattedMessage implements Message {
} catch (final Exception ignored) {
// Also not properly formatted.
}
- return new ParameterizedMessage(msgPattern, args, throwable);
+ return new ParameterizedMessage(msgPattern, args, aThrowable);
}
@Override
[27/35] logging-log4j2 git commit: Checkstyle: line length (IDE
autoformatted)
Posted by rp...@apache.org.
Checkstyle: line length (IDE autoformatted)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/25fd59e1
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/25fd59e1
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/25fd59e1
Branch: refs/heads/master
Commit: 25fd59e1e0316d07f152646fd24c876702ec3f8f
Parents: 2539d03
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:36:58 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:36:58 2015 +0200
----------------------------------------------------------------------
.../main/java/org/apache/logging/log4j/util/EnglishEnums.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/25fd59e1/log4j-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java
index c561c33..be6b346 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java
@@ -14,7 +14,7 @@
* See the license for the specific language governing permissions and
* limitations under the license.
*/
- package org.apache.logging.log4j.util;
+package org.apache.logging.log4j.util;
import java.util.Locale;
@@ -25,8 +25,8 @@ import java.util.Locale;
* Helps convert English Strings to English Enum values.
* </p>
* <p>
- * Enum name arguments are converted internally to upper case with the {@linkplain Locale#ENGLISH ENGLISH} locale to avoid problems on the
- * Turkish locale. Do not use with Turkish enum values.
+ * Enum name arguments are converted internally to upper case with the {@linkplain Locale#ENGLISH ENGLISH} locale to
+ * avoid problems on the Turkish locale. Do not use with Turkish enum values.
* </p>
*/
public final class EnglishEnums {
[02/35] logging-log4j2 git commit: Checkstyle: ConstantName,
DeclarationOrder, LineLength, JavadocStyle, FileTabCharacter
Posted by rp...@apache.org.
Checkstyle: ConstantName, DeclarationOrder, LineLength, JavadocStyle,
FileTabCharacter
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/73f3f44c
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/73f3f44c
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/73f3f44c
Branch: refs/heads/master
Commit: 73f3f44cf65daea2df34aa5ef43a3fb8d09856cf
Parents: 74aa89a
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 08:41:09 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 08:41:09 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/Level.java | 69 ++++++++++----------
1 file changed, 34 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/73f3f44c/log4j-api/src/main/java/org/apache/logging/log4j/Level.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/Level.java b/log4j-api/src/main/java/org/apache/logging/log4j/Level.java
index 2f86f21..803799e 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/Level.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/Level.java
@@ -38,15 +38,12 @@ import org.apache.logging.log4j.spi.StandardLevel;
* <li>{@link #ALL} (least specific, all data)</li>
* </ul>
*
- * Typically, configuring a level in a filter or on a logger will cause logging events of that level and those
- * that are more specific to pass through the filter.
- * A special level, {@link #ALL}, is guaranteed to capture all levels when used in logging configurations.
+ * Typically, configuring a level in a filter or on a logger will cause logging events of that level and those that are
+ * more specific to pass through the filter. A special level, {@link #ALL}, is guaranteed to capture all levels when
+ * used in logging configurations.
*/
public final class Level implements Comparable<Level>, Serializable {
- private static final long serialVersionUID = 1581082L;
- private static final ConcurrentMap<String, Level> levels = new ConcurrentHashMap<>();
-
/**
* No events will be logged.
*/
@@ -103,6 +100,9 @@ public final class Level implements Comparable<Level>, Serializable {
*/
public static final String CATEGORY = "Level";
+ private static final long serialVersionUID = 1581082L;
+ private static final ConcurrentMap<String, Level> LEVELS = new ConcurrentHashMap<>();
+
private final String name;
private final int intLevel;
private final StandardLevel standardLevel;
@@ -117,7 +117,7 @@ public final class Level implements Comparable<Level>, Serializable {
this.name = name;
this.intLevel = intLevel;
this.standardLevel = StandardLevel.getStandardLevel(intLevel);
- if (levels.putIfAbsent(name, this) != null) {
+ if (LEVELS.putIfAbsent(name, this) != null) {
throw new IllegalStateException("Level " + name + " has already been defined.");
}
}
@@ -141,12 +141,11 @@ public final class Level implements Comparable<Level>, Serializable {
}
/**
- * Compares this level against the levels passed as arguments and returns true if this level is in between the given levels.
+ * Compares this level against the levels passed as arguments and returns true if this level is in between the given
+ * levels.
*
- * @param minLevel
- * The minimum level to test.
- * @param maxLevel
- * The maximum level to test.
+ * @param minLevel The minimum level to test.
+ * @param maxLevel The maximum level to test.
* @return True true if this level is in between the given levels
* @since 2.4
*/
@@ -156,10 +155,9 @@ public final class Level implements Comparable<Level>, Serializable {
/**
* Compares this level against the level passed as an argument and returns true if this level is the same or is less
- * specific.T
+ * specific.
*
- * @param level
- * The level to test.
+ * @param level The level to test.
* @return True if this level Level is less specific or the same as the given Level.
*/
public boolean isLessSpecificThan(final Level level) {
@@ -170,8 +168,7 @@ public final class Level implements Comparable<Level>, Serializable {
* Compares this level against the level passed as an argument and returns true if this level is the same or is more
* specific.
*
- * @param level
- * The level to test.
+ * @param level The level to test.
* @return True if this level Level is more specific or the same as the given Level.
*/
public boolean isMoreSpecificThan(final Level level) {
@@ -219,13 +216,14 @@ public final class Level implements Comparable<Level>, Serializable {
/**
* Retrieves an existing Level or creates on if it didn't previously exist.
+ *
* @param name The name of the level.
* @param intValue The integer value for the Level. If the level was previously created this value is ignored.
* @return The Level.
* @throws java.lang.IllegalArgumentException if the name is null or intValue is less than zero.
*/
public static Level forName(final String name, final int intValue) {
- final Level level = levels.get(name);
+ final Level level = LEVELS.get(name);
if (level != null) {
return level;
}
@@ -233,22 +231,23 @@ public final class Level implements Comparable<Level>, Serializable {
return new Level(name, intValue);
} catch (final IllegalStateException ex) {
// The level was added by something else so just return that one.
- return levels.get(name);
+ return LEVELS.get(name);
}
}
/**
* Return the Level associated with the name or null if the Level cannot be found.
+ *
* @param name The name of the Level.
* @return The Level or null.
*/
public static Level getLevel(final String name) {
- return levels.get(name);
+ return LEVELS.get(name);
}
/**
- * Converts the string passed as argument to a level. If the
- * conversion fails, then this method returns {@link #DEBUG}.
+ * Converts the string passed as argument to a level. If the conversion fails, then this method returns
+ * {@link #DEBUG}.
*
* @param sArg The name of the desired Level.
* @return The Level associated with the String.
@@ -258,8 +257,7 @@ public final class Level implements Comparable<Level>, Serializable {
}
/**
- * Converts the string passed as argument to a level. If the
- * conversion fails, then this method returns the value of
+ * Converts the string passed as argument to a level. If the conversion fails, then this method returns the value of
* <code>defaultLevel</code>.
*
* @param name The name of the desired Level.
@@ -270,32 +268,34 @@ public final class Level implements Comparable<Level>, Serializable {
if (name == null) {
return defaultLevel;
}
- final Level level = levels.get(name.toUpperCase(Locale.ENGLISH));
+ final Level level = LEVELS.get(name.toUpperCase(Locale.ENGLISH));
return level == null ? defaultLevel : level;
}
/**
* Return an array of all the Levels that have been registered.
+ *
* @return An array of Levels.
*/
public static Level[] values() {
- final Collection<Level> values = Level.levels.values();
+ final Collection<Level> values = Level.LEVELS.values();
return values.toArray(new Level[values.size()]);
}
/**
* Return the Level associated with the name.
+ *
* @param name The name of the Level to return.
* @return The Level.
* @throws java.lang.NullPointerException if the Level name is {@code null}.
* @throws java.lang.IllegalArgumentException if the Level name is not registered.
*/
public static Level valueOf(final String name) {
- Objects.requireNonNull(name, "No level name given.");
+ Objects.requireNonNull(name, "No level name given.");
final String levelName = name.toUpperCase(Locale.ENGLISH);
- final Level level = levels.get(levelName);
+ final Level level = LEVELS.get(levelName);
if (level != null) {
- return level;
+ return level;
}
throw new IllegalArgumentException("Unknown level constant [" + levelName + "].");
}
@@ -305,12 +305,12 @@ public final class Level implements Comparable<Level>, Serializable {
* identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
*
* @param enumType the {@code Class} object of the enum type from which to return a constant
- * @param name the name of the constant to return
- * @param <T> The enum type whose constant is to be returned
+ * @param name the name of the constant to return
+ * @param <T> The enum type whose constant is to be returned
* @return the enum constant of the specified enum type with the specified name
- * @throws java.lang.IllegalArgumentException if the specified enum type has no constant with the specified name,
- * or the specified class object does not represent an enum type
- * @throws java.lang.NullPointerException if {@code enumType} or {@code name} are {@code null}
+ * @throws java.lang.IllegalArgumentException if the specified enum type has no constant with the specified name, or
+ * the specified class object does not represent an enum type
+ * @throws java.lang.NullPointerException if {@code enumType} or {@code name} are {@code null}
* @see java.lang.Enum#valueOf(Class, String)
*/
public static <T extends Enum<T>> T valueOf(final Class<T> enumType, final String name) {
@@ -322,4 +322,3 @@ public final class Level implements Comparable<Level>, Serializable {
return Level.valueOf(this.name);
}
}
-
[21/35] logging-log4j2 git commit: Checkstyle: LineLength,
trailing space (IDE autoformatted)
Posted by rp...@apache.org.
Checkstyle: LineLength, trailing space (IDE autoformatted)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/caa5a6e0
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/caa5a6e0
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/caa5a6e0
Branch: refs/heads/master
Commit: caa5a6e0833494156cd0a678a1f97d9c1dd4710e
Parents: 51efa23
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:26:13 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:26:13 2015 +0200
----------------------------------------------------------------------
.../log4j/spi/ExtendedLoggerWrapper.java | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/caa5a6e0/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLoggerWrapper.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLoggerWrapper.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLoggerWrapper.java
index cfcea75..b5ef667 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLoggerWrapper.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLoggerWrapper.java
@@ -27,7 +27,7 @@ import org.apache.logging.log4j.message.MessageFactory;
public class ExtendedLoggerWrapper extends AbstractLogger {
private static final long serialVersionUID = 1L;
-
+
/**
* The wrapped Logger.
*/
@@ -35,6 +35,7 @@ public class ExtendedLoggerWrapper extends AbstractLogger {
/**
* Constructor that wraps and existing Logger.
+ *
* @param logger The Logger to wrap.
* @param name The name of the Logger.
* @param messageFactory TODO
@@ -51,6 +52,7 @@ public class ExtendedLoggerWrapper extends AbstractLogger {
/**
* Detect if the event would be logged.
+ *
* @param level The logging Level to check.
* @param marker A Marker or null.
* @param message The Message.
@@ -64,6 +66,7 @@ public class ExtendedLoggerWrapper extends AbstractLogger {
/**
* Detect if the event would be logged.
+ *
* @param level The logging Level to check.
* @param marker A Marker or null.
* @param message The message.
@@ -77,6 +80,7 @@ public class ExtendedLoggerWrapper extends AbstractLogger {
/**
* Detect if the event would be logged.
+ *
* @param level The logging Level to check.
* @param marker A Marker or null.
* @param message The message.
@@ -89,6 +93,7 @@ public class ExtendedLoggerWrapper extends AbstractLogger {
/**
* Detect if the event would be logged.
+ *
* @param level The logging Level to check.
* @param marker A Marker or null.
* @param message The message.
@@ -99,9 +104,10 @@ public class ExtendedLoggerWrapper extends AbstractLogger {
public boolean isEnabled(final Level level, final Marker marker, final String message, final Object... params) {
return logger.isEnabled(level, marker, message, params);
}
-
+
/**
* Detect if the event would be logged.
+ *
* @param level The logging Level to check.
* @param marker A Marker or null.
* @param message The message.
@@ -114,16 +120,18 @@ public class ExtendedLoggerWrapper extends AbstractLogger {
}
/**
- * Always log an event. This tends to be already guarded by an enabled check, so this method
- * should not check for the logger level again
- * @param fqcn The fully qualified class name of the <b>caller</b>
- * @param level The logging level
- * @param marker The Marker
+ * Always log an event. This tends to be already guarded by an enabled check, so this method should not check for
+ * the logger level again
+ *
+ * @param fqcn The fully qualified class name of the <b>caller</b>
+ * @param level The logging level
+ * @param marker The Marker
* @param message The Message.
- * @param t A Throwable or null.
+ * @param t A Throwable or null.
*/
@Override
- public void logMessage(final String fqcn, final Level level, final Marker marker, final Message message, final Throwable t) {
+ public void logMessage(final String fqcn, final Level level, final Marker marker, final Message message,
+ final Throwable t) {
logger.logMessage(fqcn, level, marker, message, t);
}
}
[34/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
IDE autoformat
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, IDE autoformat
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/6ab13dd6
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/6ab13dd6
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/6ab13dd6
Branch: refs/heads/master
Commit: 6ab13dd6c852d6e845ba4cce7f7be0dec5349d3e
Parents: 7de6fc0
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 10:44:17 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 10:44:17 2015 +0200
----------------------------------------------------------------------
.../org/apache/logging/log4j/util/Strings.java | 29 ++++++++------------
1 file changed, 11 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6ab13dd6/log4j-api/src/main/java/org/apache/logging/log4j/util/Strings.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/Strings.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/Strings.java
index 5b1c8eb..27f71a9 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/Strings.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/Strings.java
@@ -23,6 +23,10 @@ package org.apache.logging.log4j.util;
*/
public final class Strings {
+ private Strings() {
+ // empty
+ }
+
/**
* The empty string.
*/
@@ -31,8 +35,7 @@ public final class Strings {
/**
* Returns a double quoted string.
*
- * @param str
- * a String
+ * @param str a String
* @return {@code "str"}
*/
public static String dquote(final String str) {
@@ -43,8 +46,7 @@ public final class Strings {
* Checks if a String is blank. A blank string is one that is {@code null}, empty, or when trimmed using
* {@link String#trim()} is empty.
*
- * @param s
- * the String to check, may be {@code null}
+ * @param s the String to check, may be {@code null}
* @return {@code true} if the String is {@code null}, empty, or trims to empty.
*/
public static boolean isBlank(final String s) {
@@ -73,8 +75,7 @@ public final class Strings {
* Copied from Apache Commons Lang org.apache.commons.lang3.StringUtils.isEmpty(CharSequence)
* </p>
*
- * @param cs
- * the CharSequence to check, may be null
+ * @param cs the CharSequence to check, may be null
* @return {@code true} if the CharSequence is empty or null
*/
public static boolean isEmpty(final CharSequence cs) {
@@ -84,8 +85,7 @@ public final class Strings {
/**
* Checks if a String is not blank. The opposite of {@link #isBlank(String)}.
*
- * @param s
- * the String to check, may be {@code null}
+ * @param s the String to check, may be {@code null}
* @return {@code true} if the String is non-{@code null} and has content after being trimmed.
*/
public static boolean isNotBlank(final String s) {
@@ -109,8 +109,7 @@ public final class Strings {
* Copied from Apache Commons Lang org.apache.commons.lang3.StringUtils.isNotEmpty(CharSequence)
* </p>
*
- * @param cs
- * the CharSequence to check, may be null
+ * @param cs the CharSequence to check, may be null
* @return {@code true} if the CharSequence is not empty and not null
*/
public static boolean isNotEmpty(final CharSequence cs) {
@@ -120,8 +119,7 @@ public final class Strings {
/**
* Returns a quoted string.
*
- * @param str
- * a String
+ * @param str a String
* @return {@code 'str'}
*/
public static String quote(final String str) {
@@ -149,16 +147,11 @@ public final class Strings {
* Copied from Apache Commons Lang org.apache.commons.lang3.StringUtils.trimToNull(String)
* </p>
*
- * @param str
- * the String to be trimmed, may be null
+ * @param str the String to be trimmed, may be null
* @return the trimmed String, {@code null} if only chars <= 32, empty or null String input
*/
public static String trimToNull(final String str) {
final String ts = str == null ? null : str.trim();
return isEmpty(ts) ? null : ts;
}
-
- private Strings() {
- // empty
- }
}
[31/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
IDE autoformat
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, IDE autoformat
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/5f80bf6d
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/5f80bf6d
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/5f80bf6d
Branch: refs/heads/master
Commit: 5f80bf6d67ca8e523e575a8844f02f7d52142d8c
Parents: a55be45
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 10:03:37 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 10:03:37 2015 +0200
----------------------------------------------------------------------
.../apache/logging/log4j/util/ProviderUtil.java | 36 ++++++++++----------
1 file changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5f80bf6d/log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java
index e26fbcb..7018c36 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java
@@ -30,10 +30,9 @@ import org.apache.logging.log4j.spi.Provider;
import org.apache.logging.log4j.status.StatusLogger;
/**
- * <em>Consider this class private.</em>
- * Utility class for Log4j {@link Provider}s. When integrating with an application container framework, any Log4j
- * Providers not accessible through standard classpath scanning should {@link #loadProvider(java.net.URL, ClassLoader)}
- * a classpath accordingly.
+ * <em>Consider this class private.</em> Utility class for Log4j {@link Provider}s. When integrating with an application
+ * container framework, any Log4j Providers not accessible through standard classpath scanning should
+ * {@link #loadProvider(java.net.URL, ClassLoader)} a classpath accordingly.
*/
public final class ProviderUtil {
@@ -41,14 +40,10 @@ public final class ProviderUtil {
* Resource name for a Log4j 2 provider properties file.
*/
protected static final String PROVIDER_RESOURCE = "META-INF/log4j-provider.properties";
- private static final String API_VERSION = "Log4jAPIVersion";
-
- private static final String[] COMPATIBLE_API_VERSIONS = {
- "2.0.0", "2.1.0"
- };
-
- private static final Logger LOGGER = StatusLogger.getLogger();
+ /**
+ * Loaded providers.
+ */
protected static final Collection<Provider> PROVIDERS = new HashSet<>();
/**
@@ -57,9 +52,14 @@ public final class ProviderUtil {
* @since 2.1
*/
protected static final Lock STARTUP_LOCK = new ReentrantLock();
+
+ private static final String API_VERSION = "Log4jAPIVersion";
+ private static final String[] COMPATIBLE_API_VERSIONS = { "2.0.0", "2.1.0" };
+ private static final Logger LOGGER = StatusLogger.getLogger();
+
// STARTUP_LOCK guards INSTANCE for lazy initialization; this allows the OSGi Activator to pause the startup and
// wait for a Provider to be installed. See LOG4J2-373
- private static volatile ProviderUtil INSTANCE;
+ private static volatile ProviderUtil instance;
private ProviderUtil() {
for (final LoaderUtil.UrlResource resource : LoaderUtil.findUrlResources(PROVIDER_RESOURCE)) {
@@ -68,8 +68,8 @@ public final class ProviderUtil {
}
/**
- * Loads an individual Provider implementation. This method is really only useful for the OSGi bundle activator
- * and this class itself.
+ * Loads an individual Provider implementation. This method is really only useful for the OSGi bundle activator and
+ * this class itself.
*
* @param url the URL to the provider properties file
* @param cl the ClassLoader to load the provider classes with
@@ -113,13 +113,13 @@ public final class ProviderUtil {
* @since 2.1
*/
protected static void lazyInit() {
- //noinspection DoubleCheckedLocking
- if (INSTANCE == null) {
+ // noinspection DoubleCheckedLocking
+ if (instance == null) {
try {
STARTUP_LOCK.lockInterruptibly();
try {
- if (INSTANCE == null) {
- INSTANCE = new ProviderUtil();
+ if (instance == null) {
+ instance = new ProviderUtil();
}
} finally {
STARTUP_LOCK.unlock();
[05/35] logging-log4j2 git commit: Checkstyle: FileTabCharacter,
removed trailing space (IDE autoformatted), removed redundant 'public' keyword
Posted by rp...@apache.org.
Checkstyle: FileTabCharacter, removed trailing space (IDE
autoformatted), removed redundant 'public' keyword
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2898bcb2
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2898bcb2
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2898bcb2
Branch: refs/heads/master
Commit: 2898bcb2c0a17b027a2ce360aadc79a6032e8d6f
Parents: 78e9af5
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 08:50:34 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 08:50:34 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/Marker.java | 40 ++++++++++++--------
1 file changed, 24 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2898bcb2/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java b/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java
index 8bad2fc..784486e 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java
@@ -19,16 +19,17 @@ package org.apache.logging.log4j;
import java.io.Serializable;
/**
- * Markers are objects that are used to add easily filterable information to log messages.
+ * Markers are objects that are used to add easily filterable information to log messages.
*
- * Markers can be hierarchical - each Marker may have a parent. This allows for broad categories
- * being subdivided into more specific categories. An example might be a Marker named "Error" with
- * children named "SystemError" and "ApplicationError".
+ * Markers can be hierarchical - each Marker may have a parent. This allows for broad categories being subdivided into
+ * more specific categories. An example might be a Marker named "Error" with children named "SystemError" and
+ * "ApplicationError".
*/
public interface Marker extends Serializable {
- /**
+ /**
* Adds a Marker as a parent to this Marker.
+ *
* @param markers The parent markers to add.
* @return The current Marker object, thus allowing multiple adds to be concatenated.
* @throws IllegalArgumentException if the argument is {@code null}
@@ -36,44 +37,48 @@ public interface Marker extends Serializable {
Marker addParents(Marker... markers);
/**
- * Returns true if the given marker has the same name as this marker.
- *
- * @param obj the reference object with which to compare.
- * @return true if the given marker has the same name as this marker.
- * @since 2.4
- */
+ * Returns true if the given marker has the same name as this marker.
+ *
+ * @param obj the reference object with which to compare.
+ * @return true if the given marker has the same name as this marker.
+ * @since 2.4
+ */
@Override
- public boolean equals(Object obj);
+ boolean equals(Object obj);
/**
* Returns the name of this Marker.
+ *
* @return The name of the Marker.
*/
String getName();
/**
* Returns a list of parents of this Marker.
+ *
* @return The parent Markers or {@code null} if this Marker has no parents.
*/
Marker[] getParents();
/**
- * Returns a hash code value based on the name of this marker.
- * Markers are equal if they have the same name.
+ * Returns a hash code value based on the name of this marker. Markers are equal if they have the same name.
+ *
* @return the computed hash code
- * @since 2.4
+ * @since 2.4
*/
@Override
- public int hashCode();
+ int hashCode();
/**
* Indicates whether this Marker has references to any other Markers.
+ *
* @return {@code true} if the Marker has parent Markers
*/
boolean hasParents();
/**
* Checks whether this Marker is an instance of the specified Marker.
+ *
* @param m The Marker to check.
* @return {@code true} if this Marker or one of its ancestors is the specified Marker, {@code false} otherwise.
* @throws IllegalArgumentException if the argument is {@code null}
@@ -82,6 +87,7 @@ public interface Marker extends Serializable {
/**
* Checks whether this Marker is an instance of the specified Marker.
+ *
* @param name The name of the Marker.
* @return {@code true} if this Marker or one of its ancestors matches the specified name, {@code false} otherwise.
* @throws IllegalArgumentException if the argument is {@code null}
@@ -90,6 +96,7 @@ public interface Marker extends Serializable {
/**
* Removes the specified Marker as a parent of this Marker.
+ *
* @param marker The marker to remove.
* @return {@code true} if the marker was removed.
* @throws IllegalArgumentException if the argument is {@code null}
@@ -98,6 +105,7 @@ public interface Marker extends Serializable {
/**
* Replaces the set of parent Markers with the provided Markers.
+ *
* @param markers The new set of parent Markers or {@code null} to clear the parents.
* @return The current Marker object.
*/
[17/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
LineLength, trailing spaces. IDE autoformatted.
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, LineLength, trailing spaces. IDE
autoformatted.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/5f532d2b
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/5f532d2b
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/5f532d2b
Branch: refs/heads/master
Commit: 5f532d2bf8ae000ab8528fdb9f0a46f156655d18
Parents: 577488b
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:18:50 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:18:50 2015 +0200
----------------------------------------------------------------------
.../logging/log4j/spi/AbstractLogger.java | 59 ++++++++++----------
1 file changed, 28 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5f532d2b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
index a5b5fdd..0d9b642 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
@@ -35,8 +35,6 @@ import org.apache.logging.log4j.util.Supplier;
*/
public abstract class AbstractLogger implements ExtendedLogger, Serializable {
- private static final long serialVersionUID = 2L;
-
/**
* Marker for flow tracing.
*/
@@ -72,39 +70,13 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
*/
public static final Class<? extends MessageFactory> DEFAULT_MESSAGE_FACTORY_CLASS = ParameterizedMessageFactory.class;
- private static final String FQCN = AbstractLogger.class.getName();
+ private static final long serialVersionUID = 2L;
+ private static final String FQCN = AbstractLogger.class.getName();
private static final String THROWING = "throwing";
-
private static final String CATCHING = "catching";
- /**
- * Checks that the message factory a logger was created with is the same as the given messageFactory. If they are
- * different log a warning to the {@linkplain StatusLogger}. A null MessageFactory translates to the default
- * MessageFactory {@link #DEFAULT_MESSAGE_FACTORY_CLASS}.
- *
- * @param logger The logger to check
- * @param messageFactory The message factory to check.
- */
- public static void checkMessageFactory(final ExtendedLogger logger, final MessageFactory messageFactory) {
- final String name = logger.getName();
- final MessageFactory loggerMessageFactory = logger.getMessageFactory();
- if (messageFactory != null && !loggerMessageFactory.equals(messageFactory)) {
- StatusLogger.getLogger().warn(
- "The Logger {} was created with the message factory {} and is now requested with the "
- + "message factory {}, which may create log events with unexpected formatting.", name,
- loggerMessageFactory, messageFactory);
- } else if (messageFactory == null && !loggerMessageFactory.getClass().equals(DEFAULT_MESSAGE_FACTORY_CLASS)) {
- StatusLogger
- .getLogger()
- .warn("The Logger {} was created with the message factory {} and is now requested with a null "
- + "message factory (defaults to {}), which may create log events with unexpected formatting.",
- name, loggerMessageFactory, DEFAULT_MESSAGE_FACTORY_CLASS.getName());
- }
- }
-
private final String name;
-
private final MessageFactory messageFactory;
/**
@@ -136,6 +108,31 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
this.messageFactory = messageFactory == null ? createDefaultMessageFactory() : messageFactory;
}
+ /**
+ * Checks that the message factory a logger was created with is the same as the given messageFactory. If they are
+ * different log a warning to the {@linkplain StatusLogger}. A null MessageFactory translates to the default
+ * MessageFactory {@link #DEFAULT_MESSAGE_FACTORY_CLASS}.
+ *
+ * @param logger The logger to check
+ * @param messageFactory The message factory to check.
+ */
+ public static void checkMessageFactory(final ExtendedLogger logger, final MessageFactory messageFactory) {
+ final String name = logger.getName();
+ final MessageFactory loggerMessageFactory = logger.getMessageFactory();
+ if (messageFactory != null && !loggerMessageFactory.equals(messageFactory)) {
+ StatusLogger.getLogger().warn(
+ "The Logger {} was created with the message factory {} and is now requested with the "
+ + "message factory {}, which may create log events with unexpected formatting.", name,
+ loggerMessageFactory, messageFactory);
+ } else if (messageFactory == null && !loggerMessageFactory.getClass().equals(DEFAULT_MESSAGE_FACTORY_CLASS)) {
+ StatusLogger
+ .getLogger()
+ .warn("The Logger {} was created with the message factory {} and is now requested with a null "
+ + "message factory (defaults to {}), which may create log events with unexpected formatting.",
+ name, loggerMessageFactory, DEFAULT_MESSAGE_FACTORY_CLASS.getName());
+ }
+ }
+
@Override
public void catching(final Level level, final Throwable t) {
catching(FQCN, level, t);
@@ -940,7 +937,7 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
}
@Override
- public void logIfEnabled(final String fqcn, final Level level, final Marker marker,
+ public void logIfEnabled(final String fqcn, final Level level, final Marker marker,
final MessageSupplier msgSupplier, final Throwable t) {
if (isEnabled(level, marker, msgSupplier, t)) {
logMessage(fqcn, level, marker, msgSupplier, t);
[15/35] logging-log4j2 git commit: Checkstyle: FileTabCharacter (IDE
autoformatted)
Posted by rp...@apache.org.
Checkstyle: FileTabCharacter (IDE autoformatted)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/c12ae7b9
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c12ae7b9
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c12ae7b9
Branch: refs/heads/master
Commit: c12ae7b9c4eb76bf4d3f9f19a361c7f2a2404247
Parents: 20e5e9c
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:14:33 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:14:33 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/simple/SimpleLoggerContext.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c12ae7b9/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java b/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java
index 34d11cb..6839290 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java
@@ -101,7 +101,7 @@ public class SimpleLoggerContext implements LoggerContext {
public ExtendedLogger getLogger(final String name, final MessageFactory messageFactory) {
final ExtendedLogger extendedLogger = loggers.get(name);
if (extendedLogger != null) {
- AbstractLogger.checkMessageFactory(extendedLogger, messageFactory);
+ AbstractLogger.checkMessageFactory(extendedLogger, messageFactory);
return extendedLogger;
}
loggers.putIfAbsent(name, new SimpleLogger(name, defaultLevel, showLogName, showShortName, showDateTime,
[24/35] logging-log4j2 git commit: Checkstyle: organized imports,
LineLength, autoformatted
Posted by rp...@apache.org.
Checkstyle: organized imports, LineLength, autoformatted
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8c9ccfda
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8c9ccfda
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8c9ccfda
Branch: refs/heads/master
Commit: 8c9ccfda21b2da2ccd22a1098cdf6dd801bdeb79
Parents: 3d335e7
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:30:20 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:30:20 2015 +0200
----------------------------------------------------------------------
.../org/apache/logging/log4j/status/StatusData.java | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8c9ccfda/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusData.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusData.java b/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusData.java
index be7dba7..65d24c8 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusData.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusData.java
@@ -16,8 +16,6 @@
*/
package org.apache.logging.log4j.status;
-import static org.apache.logging.log4j.util.Chars.SPACE;
-
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.Serializable;
@@ -27,6 +25,8 @@ import java.util.Date;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.message.Message;
+import static org.apache.logging.log4j.util.Chars.*;
+
/**
* The Status data.
*/
@@ -43,13 +43,15 @@ public class StatusData implements Serializable {
/**
* Creates the StatusData object.
+ *
* @param caller The method that created the event.
* @param level The logging level.
* @param msg The message String.
* @param t The Error or Exception that occurred.
* @param threadName The thread name
*/
- public StatusData(final StackTraceElement caller, final Level level, final Message msg, final Throwable t, String threadName) {
+ public StatusData(final StackTraceElement caller, final Level level, final Message msg, final Throwable t,
+ String threadName) {
this.timestamp = System.currentTimeMillis();
this.caller = caller;
this.level = level;
@@ -60,6 +62,7 @@ public class StatusData implements Serializable {
/**
* Returns the event's timestamp.
+ *
* @return The event's timestamp.
*/
public long getTimestamp() {
@@ -68,6 +71,7 @@ public class StatusData implements Serializable {
/**
* Returns the StackTraceElement for the method that created the event.
+ *
* @return The StackTraceElement.
*/
public StackTraceElement getStackTraceElement() {
@@ -76,6 +80,7 @@ public class StatusData implements Serializable {
/**
* Returns the logging level for the event.
+ *
* @return The logging level.
*/
public Level getLevel() {
@@ -84,6 +89,7 @@ public class StatusData implements Serializable {
/**
* Returns the message associated with the event.
+ *
* @return The message associated with the event.
*/
public Message getMessage() {
@@ -99,6 +105,7 @@ public class StatusData implements Serializable {
/**
* Returns the Throwable associated with the event.
+ *
* @return The Throwable associated with the event.
*/
public Throwable getThrowable() {
@@ -107,6 +114,7 @@ public class StatusData implements Serializable {
/**
* Formats the StatusData for viewing.
+ *
* @return The formatted status data as a String.
*/
public String getFormattedStatus() {
[03/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
LineLength, FileTabCharacter
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, LineLength, FileTabCharacter
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2ec144c3
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2ec144c3
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2ec144c3
Branch: refs/heads/master
Commit: 2ec144c36f74c1b976c79ad7629447266ae753e4
Parents: 73f3f44
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 08:45:31 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 08:45:31 2015 +0200
----------------------------------------------------------------------
.../org/apache/logging/log4j/LogManager.java | 200 ++++++++++---------
1 file changed, 104 insertions(+), 96 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2ec144c3/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java b/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
index c99837d..4f26b7c 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
@@ -35,37 +35,37 @@ import org.apache.logging.log4j.util.ReflectionUtil;
import org.apache.logging.log4j.util.Strings;
/**
- * The anchor point for the logging system. The most common usage of this class is to obtain a named
- * {@link Logger}. The method {@link #getLogger()} is provided as the most convenient way to obtain a named Logger
- * based on the calling class name. This class also provides method for obtaining named Loggers that use
- * {@link String#format(String, Object...)} style messages instead of the default type of parameterized messages.
- * These are obtained through the {@link #getFormatterLogger(Class)} family of methods. Other service provider methods
- * are given through the {@link #getContext()} and {@link #getFactory()} family of methods; these methods are not
- * normally useful for typical usage of Log4j.
+ * The anchor point for the logging system. The most common usage of this class is to obtain a named {@link Logger}. The
+ * method {@link #getLogger()} is provided as the most convenient way to obtain a named Logger based on the calling
+ * class name. This class also provides method for obtaining named Loggers that use
+ * {@link String#format(String, Object...)} style messages instead of the default type of parameterized messages. These
+ * are obtained through the {@link #getFormatterLogger(Class)} family of methods. Other service provider methods are
+ * given through the {@link #getContext()} and {@link #getFactory()} family of methods; these methods are not normally
+ * useful for typical usage of Log4j.
*/
public class LogManager {
- private static volatile LoggerContextFactory factory;
-
/**
* Log4j property to set to the fully qualified class name of a custom implementation of
* {@link org.apache.logging.log4j.spi.LoggerContextFactory}.
*/
public static final String FACTORY_PROPERTY_NAME = "log4j2.loggerContextFactory";
- private static final Logger LOGGER = StatusLogger.getLogger();
-
/**
* The name of the root Logger.
*/
public static final String ROOT_LOGGER_NAME = Strings.EMPTY;
+ private static final Logger LOGGER = StatusLogger.getLogger();
+
// for convenience
private static final String FQCN = LogManager.class.getName();
+ private static volatile LoggerContextFactory factory;
+
/**
- * Scans the classpath to find all logging implementation. Currently, only one will
- * be used but this could be extended to allow multiple implementations to be used.
+ * Scans the classpath to find all logging implementation. Currently, only one will be used but this could be
+ * extended to allow multiple implementations to be used.
*/
static {
// Shortcut binding to force a specific logging implementation.
@@ -95,8 +95,8 @@ public class LogManager {
try {
factories.put(provider.getPriority(), factoryClass.newInstance());
} catch (final Exception e) {
- LOGGER.error("Unable to create class {} specified in {}", factoryClass.getName(),
- provider.getUrl().toString(), e);
+ LOGGER.error("Unable to create class {} specified in {}", factoryClass.getName(), provider
+ .getUrl().toString(), e);
}
}
}
@@ -105,7 +105,7 @@ public class LogManager {
LOGGER.error("Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...");
factory = new SimpleLoggerContextFactory();
} else if (factories.size() == 1) {
- factory = factories.get(factories.lastKey());
+ factory = factories.get(factories.lastKey());
} else {
final StringBuilder sb = new StringBuilder("Multiple logging implementations found: \n");
for (final Map.Entry<Integer, LoggerContextFactory> entry : factories.entrySet()) {
@@ -125,10 +125,15 @@ public class LogManager {
}
/**
+ * Prevents instantiation
+ */
+ protected LogManager() {
+ }
+
+ /**
* Detects if a Logger with the specified name exists. This is a convenience method for porting from version 1.
*
- * @param name
- * The Logger name to search for.
+ * @param name The Logger name to search for.
* @return true if the Logger exists, false otherwise.
* @see LoggerContext#hasLogger(String)
*/
@@ -139,10 +144,11 @@ public class LogManager {
/**
* Returns the current LoggerContext.
* <p>
- * WARNING - The LoggerContext returned by this method may not be the LoggerContext used to create a Logger
- * for the calling class.
+ * WARNING - The LoggerContext returned by this method may not be the LoggerContext used to create a Logger for the
+ * calling class.
* </p>
- * @return The current LoggerContext.
+ *
+ * @return The current LoggerContext.
*/
public static LoggerContext getContext() {
return factory.getContext(FQCN, null, null, true);
@@ -152,9 +158,9 @@ public class LogManager {
* Returns a LoggerContext.
*
* @param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
- * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
- * returned and if the caller is a class in the container's classpath then a different LoggerContext may be
- * returned. If true then only a single LoggerContext will be returned.
+ * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
+ * returned and if the caller is a class in the container's classpath then a different LoggerContext may
+ * be returned. If true then only a single LoggerContext will be returned.
* @return a LoggerContext.
*/
public static LoggerContext getContext(final boolean currentContext) {
@@ -166,11 +172,11 @@ public class LogManager {
* Returns a LoggerContext.
*
* @param loader The ClassLoader for the context. If null the context will attempt to determine the appropriate
- * ClassLoader.
+ * ClassLoader.
* @param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
- * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
- * returned and if the caller is a class in the container's classpath then a different LoggerContext may be
- * returned. If true then only a single LoggerContext will be returned.
+ * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
+ * returned and if the caller is a class in the container's classpath then a different LoggerContext may
+ * be returned. If true then only a single LoggerContext will be returned.
* @return a LoggerContext.
*/
public static LoggerContext getContext(final ClassLoader loader, final boolean currentContext) {
@@ -181,16 +187,16 @@ public class LogManager {
* Returns a LoggerContext.
*
* @param loader The ClassLoader for the context. If null the context will attempt to determine the appropriate
- * ClassLoader.
+ * ClassLoader.
* @param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
- * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
- * returned and if the caller is a class in the container's classpath then a different LoggerContext may be
- * returned. If true then only a single LoggerContext will be returned.
+ * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
+ * returned and if the caller is a class in the container's classpath then a different LoggerContext may
+ * be returned. If true then only a single LoggerContext will be returned.
* @param externalContext An external context (such as a ServletContext) to be associated with the LoggerContext.
* @return a LoggerContext.
*/
public static LoggerContext getContext(final ClassLoader loader, final boolean currentContext,
- final Object externalContext) {
+ final Object externalContext) {
return factory.getContext(FQCN, loader, externalContext, currentContext);
}
@@ -198,66 +204,64 @@ public class LogManager {
* Returns a LoggerContext.
*
* @param loader The ClassLoader for the context. If null the context will attempt to determine the appropriate
- * ClassLoader.
+ * ClassLoader.
* @param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
- * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
- * returned and if the caller is a class in the container's classpath then a different LoggerContext may be
- * returned. If true then only a single LoggerContext will be returned.
+ * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
+ * returned and if the caller is a class in the container's classpath then a different LoggerContext may
+ * be returned. If true then only a single LoggerContext will be returned.
* @param configLocation The URI for the configuration to use.
* @return a LoggerContext.
*/
public static LoggerContext getContext(final ClassLoader loader, final boolean currentContext,
- final URI configLocation) {
+ final URI configLocation) {
return factory.getContext(FQCN, loader, null, currentContext, configLocation, null);
}
-
/**
* Returns a LoggerContext.
*
* @param loader The ClassLoader for the context. If null the context will attempt to determine the appropriate
- * ClassLoader.
+ * ClassLoader.
* @param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
- * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
- * returned and if the caller is a class in the container's classpath then a different LoggerContext may be
- * returned. If true then only a single LoggerContext will be returned.
+ * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
+ * returned and if the caller is a class in the container's classpath then a different LoggerContext may
+ * be returned. If true then only a single LoggerContext will be returned.
* @param externalContext An external context (such as a ServletContext) to be associated with the LoggerContext.
* @param configLocation The URI for the configuration to use.
* @return a LoggerContext.
*/
public static LoggerContext getContext(final ClassLoader loader, final boolean currentContext,
- final Object externalContext, final URI configLocation) {
+ final Object externalContext, final URI configLocation) {
return factory.getContext(FQCN, loader, externalContext, currentContext, configLocation, null);
}
-
/**
* Returns a LoggerContext.
*
* @param loader The ClassLoader for the context. If null the context will attempt to determine the appropriate
- * ClassLoader.
+ * ClassLoader.
* @param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
- * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
- * returned and if the caller is a class in the container's classpath then a different LoggerContext may be
- * returned. If true then only a single LoggerContext will be returned.
+ * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
+ * returned and if the caller is a class in the container's classpath then a different LoggerContext may
+ * be returned. If true then only a single LoggerContext will be returned.
* @param externalContext An external context (such as a ServletContext) to be associated with the LoggerContext.
* @param configLocation The URI for the configuration to use.
* @param name The LoggerContext name.
* @return a LoggerContext.
*/
public static LoggerContext getContext(final ClassLoader loader, final boolean currentContext,
- final Object externalContext, final URI configLocation,
- final String name) {
+ final Object externalContext, final URI configLocation, final String name) {
return factory.getContext(FQCN, loader, externalContext, currentContext, configLocation, name);
}
/**
* Returns a LoggerContext
+ *
* @param fqcn The fully qualified class name of the Class that this method is a member of.
* @param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
- * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
- * returned and if the caller is a class in the container's classpath then a different LoggerContext may be
- * returned. If true then only a single LoggerContext will be returned.
+ * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
+ * returned and if the caller is a class in the container's classpath then a different LoggerContext may
+ * be returned. If true then only a single LoggerContext will be returned.
* @return a LoggerContext.
*/
protected static LoggerContext getContext(final String fqcn, final boolean currentContext) {
@@ -266,22 +270,23 @@ public class LogManager {
/**
* Returns a LoggerContext
+ *
* @param fqcn The fully qualified class name of the Class that this method is a member of.
* @param loader The ClassLoader for the context. If null the context will attempt to determine the appropriate
- * ClassLoader.
+ * ClassLoader.
* @param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
- * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
- * returned and if the caller is a class in the container's classpath then a different LoggerContext may be
- * returned. If true then only a single LoggerContext will be returned.
+ * example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
+ * returned and if the caller is a class in the container's classpath then a different LoggerContext may
+ * be returned. If true then only a single LoggerContext will be returned.
* @return a LoggerContext.
*/
- protected static LoggerContext getContext(final String fqcn, final ClassLoader loader,
- final boolean currentContext) {
+ protected static LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext) {
return factory.getContext(fqcn, loader, null, currentContext);
}
/**
* Returns the current LoggerContextFactory.
+ *
* @return The LoggerContextFactory.
*/
public static LoggerContextFactory getFactory() {
@@ -311,6 +316,7 @@ public class LogManager {
* <p>
* This logger lets you use a {@link java.util.Formatter} string in the message to format parameters.
* </p>
+ *
* @return The Logger for the calling class.
* @throws UnsupportedOperationException if the calling class cannot be determined.
* @since 2.4
@@ -319,7 +325,6 @@ public class LogManager {
return getFormatterLogger(ReflectionUtil.getCallerClass(2));
}
-
/**
* Returns a formatter Logger using the fully qualified name of the Class as the Logger name.
* <p>
@@ -329,10 +334,10 @@ public class LogManager {
* Short-hand for {@code getLogger(clazz, StringFormatterMessageFactory.INSTANCE)}
* </p>
*
- * @param clazz
- * The Class whose name should be used as the Logger name.
+ * @param clazz The Class whose name should be used as the Logger name.
* @return The Logger, created with a {@link StringFormatterMessageFactory}
- * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be determined.
+ * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be
+ * determined.
* @see Logger#fatal(Marker, String, Object...)
* @see Logger#fatal(String, Object...)
* @see Logger#error(Marker, String, Object...)
@@ -349,7 +354,7 @@ public class LogManager {
*/
public static Logger getFormatterLogger(final Class<?> clazz) {
return getLogger(clazz != null ? clazz : ReflectionUtil.getCallerClass(2),
- StringFormatterMessageFactory.INSTANCE);
+ StringFormatterMessageFactory.INSTANCE);
}
/**
@@ -361,10 +366,10 @@ public class LogManager {
* Short-hand for {@code getLogger(value, StringFormatterMessageFactory.INSTANCE)}
* </p>
*
- * @param value
- * The value's whose class name should be used as the Logger name.
+ * @param value The value's whose class name should be used as the Logger name.
* @return The Logger, created with a {@link StringFormatterMessageFactory}
- * @throws UnsupportedOperationException if {@code value} is {@code null} and the calling class cannot be determined.
+ * @throws UnsupportedOperationException if {@code value} is {@code null} and the calling class cannot be
+ * determined.
* @see Logger#fatal(Marker, String, Object...)
* @see Logger#fatal(String, Object...)
* @see Logger#error(Marker, String, Object...)
@@ -381,7 +386,7 @@ public class LogManager {
*/
public static Logger getFormatterLogger(final Object value) {
return getLogger(value != null ? value.getClass() : ReflectionUtil.getCallerClass(2),
- StringFormatterMessageFactory.INSTANCE);
+ StringFormatterMessageFactory.INSTANCE);
}
/**
@@ -412,7 +417,7 @@ public class LogManager {
*/
public static Logger getFormatterLogger(final String name) {
return name == null ? getFormatterLogger(ReflectionUtil.getCallerClass(2)) : getLogger(name,
- StringFormatterMessageFactory.INSTANCE);
+ StringFormatterMessageFactory.INSTANCE);
}
private static Class<?> callerClass(final Class<?> clazz) {
@@ -428,6 +433,7 @@ public class LogManager {
/**
* Returns a Logger with the name of the calling class.
+ *
* @return The Logger for the calling class.
* @throws UnsupportedOperationException if the calling class cannot be determined.
*/
@@ -437,10 +443,12 @@ public class LogManager {
/**
* Returns a Logger using the fully qualified name of the Class as the Logger name.
+ *
* @param clazz The Class whose name should be used as the Logger name. If null it will default to the calling
- * class.
+ * class.
* @return The Logger.
- * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be determined.
+ * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be
+ * determined.
*/
public static Logger getLogger(final Class<?> clazz) {
final Class<?> cls = callerClass(clazz);
@@ -449,12 +457,14 @@ public class LogManager {
/**
* Returns a Logger using the fully qualified name of the Class as the Logger name.
+ *
* @param clazz The Class whose name should be used as the Logger name. If null it will default to the calling
- * class.
- * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
- * the logger but will log a warning if mismatched.
+ * class.
+ * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change the
+ * logger but will log a warning if mismatched.
* @return The Logger.
- * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be determined.
+ * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be
+ * determined.
*/
public static Logger getLogger(final Class<?> clazz, final MessageFactory messageFactory) {
final Class<?> cls = callerClass(clazz);
@@ -463,8 +473,9 @@ public class LogManager {
/**
* Returns a Logger with the name of the calling class.
- * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
- * the logger but will log a warning if mismatched.
+ *
+ * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change the
+ * logger but will log a warning if mismatched.
* @return The Logger for the calling class.
* @throws UnsupportedOperationException if the calling class cannot be determined.
*/
@@ -474,10 +485,12 @@ public class LogManager {
/**
* Returns a Logger using the fully qualified class name of the value as the Logger name.
- * @param value The value whose class name should be used as the Logger name. If null the name of the calling
- * class will be used as the logger name.
+ *
+ * @param value The value whose class name should be used as the Logger name. If null the name of the calling class
+ * will be used as the logger name.
* @return The Logger.
- * @throws UnsupportedOperationException if {@code value} is {@code null} and the calling class cannot be determined.
+ * @throws UnsupportedOperationException if {@code value} is {@code null} and the calling class cannot be
+ * determined.
*/
public static Logger getLogger(final Object value) {
return getLogger(value != null ? value.getClass() : ReflectionUtil.getCallerClass(2));
@@ -485,12 +498,14 @@ public class LogManager {
/**
* Returns a Logger using the fully qualified class name of the value as the Logger name.
- * @param value The value whose class name should be used as the Logger name. If null the name of the calling
- * class will be used as the logger name.
- * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
- * the logger but will log a warning if mismatched.
+ *
+ * @param value The value whose class name should be used as the Logger name. If null the name of the calling class
+ * will be used as the logger name.
+ * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change the
+ * logger but will log a warning if mismatched.
* @return The Logger.
- * @throws UnsupportedOperationException if {@code value} is {@code null} and the calling class cannot be determined.
+ * @throws UnsupportedOperationException if {@code value} is {@code null} and the calling class cannot be
+ * determined.
*/
public static Logger getLogger(final Object value, final MessageFactory messageFactory) {
return getLogger(value != null ? value.getClass() : ReflectionUtil.getCallerClass(2), messageFactory);
@@ -511,14 +526,14 @@ public class LogManager {
* Returns a Logger with the specified name.
*
* @param name The logger name. If null the name of the calling class will be used.
- * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
- * the logger but will log a warning if mismatched.
+ * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change the
+ * logger but will log a warning if mismatched.
* @return The Logger.
* @throws UnsupportedOperationException if {@code name} is {@code null} and the calling class cannot be determined.
*/
public static Logger getLogger(final String name, final MessageFactory messageFactory) {
return name != null ? getContext(false).getLogger(name, messageFactory) : getLogger(
- ReflectionUtil.getCallerClass(2), messageFactory);
+ ReflectionUtil.getCallerClass(2), messageFactory);
}
/**
@@ -540,11 +555,4 @@ public class LogManager {
public static Logger getRootLogger() {
return getLogger(ROOT_LOGGER_NAME);
}
-
- /**
- * Prevents instantiation
- */
- protected LogManager() {
- }
-
}
[26/35] logging-log4j2 git commit: Checkstyle: Missing a Javadoc
comment, utility class should hide constructor.
Posted by rp...@apache.org.
Checkstyle: Missing a Javadoc comment, utility class should hide
constructor.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2539d035
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2539d035
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2539d035
Branch: refs/heads/master
Commit: 2539d035556b1c185cc58139d5a7ac181568b4dd
Parents: 6f69d24
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:35:37 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:35:37 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/util/Chars.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2539d035/log4j-api/src/main/java/org/apache/logging/log4j/util/Chars.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/Chars.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/Chars.java
index b2efb1c..75328d0 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/Chars.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/Chars.java
@@ -21,12 +21,27 @@ package org.apache.logging.log4j.util;
*/
public class Chars {
+ /** Carriage Return. */
public static final char CR = '\r';
+
+ /** Double Quote. */
public static final char DQUOTE = '\"';
+
+ /** Equals '='. */
public static final char EQ = '=';
+
+ /** Line Feed. */
public static final char LF = '\n';
+
+ /** Single Quote [']. */
public static final char QUOTE = '\'';
+
+ /** Space. */
public static final char SPACE = ' ';
+
+ /** Tab. */
public static final char TAB = '\t';
+ private Chars() {
+ }
}
[11/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
also IDE autoformatted
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, also IDE autoformatted
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/13748f3a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/13748f3a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/13748f3a
Branch: refs/heads/master
Commit: 13748f3a2a42d7f927452c5a32377d1002f8e458
Parents: 3bb8524
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:07:07 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:07:07 2015 +0200
----------------------------------------------------------------------
.../logging/log4j/message/ParameterizedMessageFactory.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/13748f3a/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessageFactory.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessageFactory.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessageFactory.java
index 8f503a7..5e97145 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessageFactory.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessageFactory.java
@@ -27,15 +27,16 @@ package org.apache.logging.log4j.message;
*/
public final class ParameterizedMessageFactory extends AbstractMessageFactory {
- private static final long serialVersionUID = 1L;
-
/**
* Instance of StringFormatterMessageFactory.
*/
public static final ParameterizedMessageFactory INSTANCE = new ParameterizedMessageFactory();
+ private static final long serialVersionUID = 1L;
+
/**
* Creates {@link ParameterizedMessage} instances.
+ *
* @param message The message pattern.
* @param params The message parameters.
* @return The Message.
[28/35] logging-log4j2 git commit: Checkstyle: util class should be
final
Posted by rp...@apache.org.
Checkstyle: util class should be final
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/54a7d2f6
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/54a7d2f6
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/54a7d2f6
Branch: refs/heads/master
Commit: 54a7d2f623934ed4eedaece37308704fdd4546dd
Parents: 25fd59e
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:38:35 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:38:35 2015 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/logging/log4j/util/LambdaUtil.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/54a7d2f6/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
index ceb4c56..53d1799 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
@@ -23,7 +23,7 @@ import org.apache.logging.log4j.message.Message;
/**
* Utility class for lambda support.
*/
-public class LambdaUtil {
+public final class LambdaUtil {
/**
* Private constructor: this class is not intended to be instantiated.
*/
[30/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
IDE autoformat
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, IDE autoformat
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/a55be454
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/a55be454
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/a55be454
Branch: refs/heads/master
Commit: a55be4549f01b06e7c0398545fef2693e04b8480
Parents: 18f821c
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 10:00:19 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 10:00:19 2015 +0200
----------------------------------------------------------------------
.../logging/log4j/util/PropertiesUtil.java | 80 ++++++++++----------
1 file changed, 38 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a55be454/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index ab283b1..0b1efe7 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -29,8 +29,8 @@ import org.apache.logging.log4j.status.StatusLogger;
/**
* <em>Consider this class private.</em>
* <p>
- * Helps access properties. This utility provides a method to override system properties by specifying properties
- * in a properties file.
+ * Helps access properties. This utility provides a method to override system properties by specifying properties in a
+ * properties file.
* </p>
*/
public final class PropertiesUtil {
@@ -51,38 +51,8 @@ public final class PropertiesUtil {
}
/**
- * Loads and closes the given property input stream.
- * If an error occurs, log to the status logger.
- *
- * @param in
- * a property input stream.
- * @param source
- * a source object describing the source, like a resource string
- * or a URL.
- * @return a new Properties object
- */
- static Properties loadClose(final InputStream in, final Object source) {
- final Properties props = new Properties();
- if (null != in) {
- try {
- props.load(in);
- } catch (final IOException e) {
- LOGGER.error("Unable to read {}", source, e);
- } finally {
- try {
- in.close();
- } catch (final IOException e) {
- LOGGER.error("Unable to close {}", source, e);
- }
- }
- }
- return props;
- }
-
- /**
* Constructs a PropertiesUtil for a given properties file name on the classpath. The properties specified in this
- * file are used by default. If a property is not defined in this file, then the equivalent system property is
- * used.
+ * file are used by default. If a property is not defined in this file, then the equivalent system property is used.
*
* @param propertiesFileName the location of properties file to load
*/
@@ -110,6 +80,31 @@ public final class PropertiesUtil {
}
/**
+ * Loads and closes the given property input stream. If an error occurs, log to the status logger.
+ *
+ * @param in a property input stream.
+ * @param source a source object describing the source, like a resource string or a URL.
+ * @return a new Properties object
+ */
+ static Properties loadClose(final InputStream in, final Object source) {
+ final Properties props = new Properties();
+ if (null != in) {
+ try {
+ props.load(in);
+ } catch (final IOException e) {
+ LOGGER.error("Unable to read {}", source, e);
+ } finally {
+ try {
+ in.close();
+ } catch (final IOException e) {
+ LOGGER.error("Unable to close {}", source, e);
+ }
+ }
+ }
+ return props;
+ }
+
+ /**
* Returns the PropertiesUtil used by Log4j.
*
* @return the main Log4j PropertiesUtil instance.
@@ -137,10 +132,10 @@ public final class PropertiesUtil {
/**
* Gets the named property as an integer.
*
- * @param name the name of the property to look up
+ * @param name the name of the property to look up
* @param defaultValue the default value to use if the property is undefined
* @return the parsed integer value of the property or {@code defaultValue} if it was undefined or could not be
- * parsed.
+ * parsed.
*/
public int getIntegerProperty(final String name, final int defaultValue) {
String prop = null;
@@ -165,10 +160,9 @@ public final class PropertiesUtil {
/**
* Gets the named property as a long.
*
- * @param name the name of the property to look up
+ * @param name the name of the property to look up
* @param defaultValue the default value to use if the property is undefined
- * @return the parsed long value of the property or {@code defaultValue} if it was undefined or could not be
- * parsed.
+ * @return the parsed long value of the property or {@code defaultValue} if it was undefined or could not be parsed.
*/
public long getLongProperty(final String name, final long defaultValue) {
String prop = null;
@@ -193,7 +187,7 @@ public final class PropertiesUtil {
/**
* Gets the named property as a String.
*
- * @param name the name of the property to look up
+ * @param name the name of the property to look up
* @param defaultValue the default value to use if the property is undefined
* @return the String value of the property or {@code defaultValue} if undefined.
*/
@@ -217,7 +211,7 @@ public final class PropertiesUtil {
/**
* Gets the named property as a boolean value.
*
- * @param name the name of the property to look up
+ * @param name the name of the property to look up
* @param defaultValue the default value to use if the property is undefined
* @return the boolean value of the property or {@code defaultValue} if undefined.
*/
@@ -228,6 +222,7 @@ public final class PropertiesUtil {
/**
* Return the system properties or an empty Properties object if an error occurs.
+ *
* @return The system properties.
*/
public static Properties getSystemProperties() {
@@ -241,8 +236,9 @@ public final class PropertiesUtil {
}
/**
- * Extracts properties that start with or are equals to the specific prefix and returns them in a
- * new Properties object with the prefix removed.
+ * Extracts properties that start with or are equals to the specific prefix and returns them in a new Properties
+ * object with the prefix removed.
+ *
* @param properties The Properties to evaluate.
* @param prefix The prefix to extract.
* @return The subset of properties.
[18/35] logging-log4j2 git commit: Checkstyle: FileTabCharacter,
IDE autoformatted
Posted by rp...@apache.org.
Checkstyle: FileTabCharacter, IDE autoformatted
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/898d64e9
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/898d64e9
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/898d64e9
Branch: refs/heads/master
Commit: 898d64e941afec2dbe06eb2041709812e406f7eb
Parents: 5f532d2
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:19:40 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:19:40 2015 +0200
----------------------------------------------------------------------
.../logging/log4j/spi/AbstractLoggerAdapter.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/898d64e9/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java
index 8dc44e1..3c6c84f 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java
@@ -26,6 +26,7 @@ import org.apache.logging.log4j.util.LoaderUtil;
/**
* Provides an abstract base class to use for implementing LoggerAdapter.
+ *
* @param <L> the Logger class to adapt
* @since 2.1
*/
@@ -34,8 +35,7 @@ public abstract class AbstractLoggerAdapter<L> implements LoggerAdapter<L> {
/**
* A map to store loggers for their given LoggerContexts.
*/
- protected final Map<LoggerContext, ConcurrentMap<String, L>> registry =
- new WeakHashMap<>();
+ protected final Map<LoggerContext, ConcurrentMap<String, L>> registry = new WeakHashMap<>();
@Override
public L getLogger(final String name) {
@@ -43,7 +43,7 @@ public abstract class AbstractLoggerAdapter<L> implements LoggerAdapter<L> {
final ConcurrentMap<String, L> loggers = getLoggersInContext(context);
final L logger = loggers.get(name);
if (logger != null) {
- return logger;
+ return logger;
}
loggers.putIfAbsent(name, newLogger(name, context));
return loggers.get(name);
@@ -69,16 +69,16 @@ public abstract class AbstractLoggerAdapter<L> implements LoggerAdapter<L> {
/**
* Creates a new named logger for a given {@link LoggerContext}.
*
- * @param name the name of the logger to create
+ * @param name the name of the logger to create
* @param context the LoggerContext this logger will be associated with
* @return the new named logger
*/
protected abstract L newLogger(final String name, final LoggerContext context);
/**
- * Gets the {@link LoggerContext} that should be used to look up or create loggers. This is similar in spirit to
- * the {@code ContextSelector} class in {@code log4j-core}. However, implementations can rely on their own
- * framework's separation of contexts instead (or simply use a singleton).
+ * Gets the {@link LoggerContext} that should be used to look up or create loggers. This is similar in spirit to the
+ * {@code ContextSelector} class in {@code log4j-core}. However, implementations can rely on their own framework's
+ * separation of contexts instead (or simply use a singleton).
*
* @return the LoggerContext to be used for lookup and creation purposes
* @see org.apache.logging.log4j.LogManager#getContext(ClassLoader, boolean)
[20/35] logging-log4j2 git commit: Checkstyle: ConstantName,
LineLength (IDE autoformatted)
Posted by rp...@apache.org.
Checkstyle: ConstantName, LineLength (IDE autoformatted)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/51efa239
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/51efa239
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/51efa239
Branch: refs/heads/master
Commit: 51efa23922d905179bdf7b88b197785244bdd813
Parents: 9cf5d4b
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:25:14 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:25:14 2015 +0200
----------------------------------------------------------------------
.../log4j/spi/DefaultThreadContextStack.java | 70 ++++++++++----------
1 file changed, 36 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/51efa239/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
index 5e2921b..241fbb7 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
@@ -25,23 +25,23 @@ import org.apache.logging.log4j.ThreadContext.ContextStack;
import org.apache.logging.log4j.util.Strings;
/**
- * A copy-on-write thread-safe variant of {@code org.apache.logging.log4j.spi.ThreadContextStack} in which all mutative operations (add,
- * pop, and so on) are implemented by making a fresh copy of the underlying list.
+ * A copy-on-write thread-safe variant of {@code org.apache.logging.log4j.spi.ThreadContextStack} in which all mutative
+ * operations (add, pop, and so on) are implemented by making a fresh copy of the underlying list.
*/
public class DefaultThreadContextStack implements ThreadContextStack {
private static final long serialVersionUID = 5050501L;
- private static final ThreadLocal<MutableThreadContextStack> stack = new ThreadLocal<>();
+ private static final ThreadLocal<MutableThreadContextStack> STACK = new ThreadLocal<>();
private final boolean useStack;
public DefaultThreadContextStack(final boolean useStack) {
this.useStack = useStack;
}
-
+
private MutableThreadContextStack getNonNullStackCopy() {
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
return (MutableThreadContextStack) (values == null ? new MutableThreadContextStack() : values.copy());
}
@@ -53,7 +53,7 @@ public class DefaultThreadContextStack implements ThreadContextStack {
final MutableThreadContextStack copy = getNonNullStackCopy();
copy.add(s);
copy.freeze();
- stack.set(copy);
+ STACK.set(copy);
return true;
}
@@ -65,13 +65,13 @@ public class DefaultThreadContextStack implements ThreadContextStack {
final MutableThreadContextStack copy = getNonNullStackCopy();
copy.addAll(strings);
copy.freeze();
- stack.set(copy);
+ STACK.set(copy);
return true;
}
@Override
public List<String> asList() {
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
if (values == null) {
return Collections.emptyList();
}
@@ -80,12 +80,12 @@ public class DefaultThreadContextStack implements ThreadContextStack {
@Override
public void clear() {
- stack.remove();
+ STACK.remove();
}
@Override
public boolean contains(final Object o) {
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
return values != null && values.contains(o);
}
@@ -95,14 +95,14 @@ public class DefaultThreadContextStack implements ThreadContextStack {
return true; // looks counter-intuitive, but see
// j.u.AbstractCollection
}
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
return values != null && values.containsAll(objects);
}
@Override
public ThreadContextStack copy() {
MutableThreadContextStack values = null;
- if (!useStack || (values = stack.get()) == null) {
+ if (!useStack || (values = STACK.get()) == null) {
return new MutableThreadContextStack();
}
return values.copy();
@@ -126,7 +126,7 @@ public class DefaultThreadContextStack implements ThreadContextStack {
return false;
}
final ThreadContextStack other = (ThreadContextStack) obj;
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
if (values == null) {
return false;
}
@@ -135,13 +135,13 @@ public class DefaultThreadContextStack implements ThreadContextStack {
@Override
public int getDepth() {
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
return values == null ? 0 : values.getDepth();
}
@Override
public int hashCode() {
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
final int prime = 31;
int result = 1;
// Factor in the stack itself to compare vs. other implementors.
@@ -151,13 +151,13 @@ public class DefaultThreadContextStack implements ThreadContextStack {
@Override
public boolean isEmpty() {
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
return values == null || values.isEmpty();
}
@Override
public Iterator<String> iterator() {
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
if (values == null) {
final List<String> empty = Collections.emptyList();
return empty.iterator();
@@ -167,7 +167,7 @@ public class DefaultThreadContextStack implements ThreadContextStack {
@Override
public String peek() {
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
if (values == null || values.size() == 0) {
return Strings.EMPTY;
}
@@ -179,7 +179,7 @@ public class DefaultThreadContextStack implements ThreadContextStack {
if (!useStack) {
return Strings.EMPTY;
}
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
if (values == null || values.size() == 0) {
// Like version 1.2
return Strings.EMPTY;
@@ -187,7 +187,7 @@ public class DefaultThreadContextStack implements ThreadContextStack {
final MutableThreadContextStack copy = (MutableThreadContextStack) values.copy();
final String result = copy.pop();
copy.freeze();
- stack.set(copy);
+ STACK.set(copy);
return result;
}
@@ -204,14 +204,14 @@ public class DefaultThreadContextStack implements ThreadContextStack {
if (!useStack) {
return false;
}
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
if (values == null || values.size() == 0) {
return false;
}
final MutableThreadContextStack copy = (MutableThreadContextStack) values.copy();
final boolean result = copy.remove(o);
copy.freeze();
- stack.set(copy);
+ STACK.set(copy);
return result;
}
@@ -220,14 +220,14 @@ public class DefaultThreadContextStack implements ThreadContextStack {
if (!useStack || objects.isEmpty()) {
return false;
}
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
if (values == null || values.isEmpty()) {
return false;
}
final MutableThreadContextStack copy = (MutableThreadContextStack) values.copy();
final boolean result = copy.removeAll(objects);
copy.freeze();
- stack.set(copy);
+ STACK.set(copy);
return result;
}
@@ -236,26 +236,26 @@ public class DefaultThreadContextStack implements ThreadContextStack {
if (!useStack || objects.isEmpty()) {
return false;
}
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
if (values == null || values.isEmpty()) {
return false;
}
final MutableThreadContextStack copy = (MutableThreadContextStack) values.copy();
final boolean result = copy.retainAll(objects);
copy.freeze();
- stack.set(copy);
+ STACK.set(copy);
return result;
}
@Override
public int size() {
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
return values == null ? 0 : values.size();
}
@Override
public Object[] toArray() {
- final MutableThreadContextStack result = stack.get();
+ final MutableThreadContextStack result = STACK.get();
if (result == null) {
return new String[0];
}
@@ -264,7 +264,7 @@ public class DefaultThreadContextStack implements ThreadContextStack {
@Override
public <T> T[] toArray(final T[] ts) {
- final MutableThreadContextStack result = stack.get();
+ final MutableThreadContextStack result = STACK.get();
if (result == null) {
if (ts.length > 0) { // as per the contract of j.u.List#toArray(T[])
ts[0] = null;
@@ -276,7 +276,7 @@ public class DefaultThreadContextStack implements ThreadContextStack {
@Override
public String toString() {
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
return values == null ? "[]" : values.toString();
}
@@ -285,21 +285,23 @@ public class DefaultThreadContextStack implements ThreadContextStack {
if (depth < 0) {
throw new IllegalArgumentException("Maximum stack depth cannot be negative");
}
- final MutableThreadContextStack values = stack.get();
+ final MutableThreadContextStack values = STACK.get();
if (values == null) {
return;
}
final MutableThreadContextStack copy = (MutableThreadContextStack) values.copy();
copy.trim(depth);
copy.freeze();
- stack.set(copy);
+ STACK.set(copy);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.logging.log4j.ThreadContext.ContextStack#getImmutableStackOrNull()
*/
@Override
public ContextStack getImmutableStackOrNull() {
- return stack.get();
+ return STACK.get();
}
}
[12/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
IDE autoformatted
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, IDE autoformatted
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/ac42b6a3
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ac42b6a3
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ac42b6a3
Branch: refs/heads/master
Commit: ac42b6a3cdfe630a3472ca3361cbd746de3dada4
Parents: 13748f3
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:08:12 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:08:12 2015 +0200
----------------------------------------------------------------------
.../logging/log4j/message/StringFormatterMessageFactory.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ac42b6a3/log4j-api/src/main/java/org/apache/logging/log4j/message/StringFormatterMessageFactory.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/StringFormatterMessageFactory.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/StringFormatterMessageFactory.java
index d51229a..8acc5d6 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/StringFormatterMessageFactory.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/StringFormatterMessageFactory.java
@@ -27,13 +27,13 @@ package org.apache.logging.log4j.message;
*/
public final class StringFormatterMessageFactory extends AbstractMessageFactory {
- private static final long serialVersionUID = 1L;
-
/**
* Instance of StringFormatterMessageFactory.
*/
public static final StringFormatterMessageFactory INSTANCE = new StringFormatterMessageFactory();
+ private static final long serialVersionUID = 1L;
+
/**
* Creates {@link StringFormattedMessage} instances.
*
[16/35] logging-log4j2 git commit: Checkstyle: 'context' hides field,
IDE autoformatted
Posted by rp...@apache.org.
Checkstyle: 'context' hides field, IDE autoformatted
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/577488b3
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/577488b3
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/577488b3
Branch: refs/heads/master
Commit: 577488b3e30ee19b183f74be6b8c52dc19ff02f1
Parents: c12ae7b
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:16:07 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:16:07 2015 +0200
----------------------------------------------------------------------
.../logging/log4j/simple/SimpleLoggerContextFactory.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/577488b3/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContextFactory.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContextFactory.java b/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContextFactory.java
index f3b1406..4162875 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContextFactory.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContextFactory.java
@@ -30,17 +30,17 @@ public class SimpleLoggerContextFactory implements LoggerContextFactory {
@Override
public LoggerContext getContext(final String fqcn, final ClassLoader loader, final Object externalContext,
- final boolean currentContext) {
+ final boolean currentContext) {
return context;
}
@Override
public LoggerContext getContext(final String fqcn, final ClassLoader loader, final Object externalContext,
- final boolean currentContext, final URI configLocation, final String name) {
+ final boolean currentContext, final URI configLocation, final String name) {
return context;
}
@Override
- public void removeContext(final LoggerContext context) {
+ public void removeContext(final LoggerContext removeContext) {
}
}
[04/35] logging-log4j2 git commit: Checkstyle: removed trailing
spaces (IDE autoformatted)
Posted by rp...@apache.org.
Checkstyle: removed trailing spaces (IDE autoformatted)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/78e9af58
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/78e9af58
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/78e9af58
Branch: refs/heads/master
Commit: 78e9af5821099051edd478facdcbfcad032b67f8
Parents: 2ec144c
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 08:48:26 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 08:48:26 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/Logger.java | 227 ++++++++++---------
1 file changed, 117 insertions(+), 110 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/78e9af58/log4j-api/src/main/java/org/apache/logging/log4j/Logger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/Logger.java b/log4j-api/src/main/java/org/apache/logging/log4j/Logger.java
index cf09c10..63eb500 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/Logger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/Logger.java
@@ -30,11 +30,12 @@ import org.apache.logging.log4j.util.Supplier;
* gets its own Logger named after its fully qualified class name (the default Logger name when obtained through the
* {@link LogManager#getLogger()} method). Thus, the simplest way to use this would be like so:
* </p>
+ *
* <pre>
- * public class MyClass {
- * private static final Logger LOGGER = LogManager.getLogger();
- * // ...
- * }
+ * public class MyClass {
+ * private static final Logger LOGGER = LogManager.getLogger();
+ * // ...
+ * }
* </pre>
* <p>
* For ease of filtering, searching, sorting, etc., it is generally a good idea to create Loggers for each class rather
@@ -45,16 +46,17 @@ import org.apache.logging.log4j.util.Supplier;
* {@link org.apache.logging.log4j.spi.AbstractLogger} class rather than implementing this interface directly.
* </p>
*
- * Since 2.4, methods have been added to the {@code Logger} interface to support lambda expressions.
- * The new methods allow client code to lazily log messages without explicitly checking if the requested log level is
- * enabled. For example, previously one would write:
+ * Since 2.4, methods have been added to the {@code Logger} interface to support lambda expressions. The new methods
+ * allow client code to lazily log messages without explicitly checking if the requested log level is enabled. For
+ * example, previously one would write:
*
* <pre>
* // pre-Java 8 style optimization: explicitly check the log level
* // to make sure the expensiveOperation() method is only called if necessary
* if (logger.isTraceEnabled()) {
* logger.trace("Some long-running operation returned {}", expensiveOperation());
- * }</pre>
+ * }
+ * </pre>
* <p>
* With Java 8, the same effect can be achieved with a lambda expression:
*
@@ -75,10 +77,10 @@ public interface Logger {
void catching(Level level, Throwable t);
/**
- * Logs an exception or error that has been caught. Normally, one may wish to provide additional information with
- * an exception while logging it; in these cases, one would not use this method. In other cases where simply
- * logging the fact that an exception was swallowed somewhere (e.g., at the top of the stack trace in a
- * {@code main()} method), this method is ideal for it.
+ * Logs an exception or error that has been caught. Normally, one may wish to provide additional information with an
+ * exception while logging it; in these cases, one would not use this method. In other cases where simply logging
+ * the fact that an exception was swallowed somewhere (e.g., at the top of the stack trace in a {@code main()}
+ * method), this method is ideal for it.
*
* @param t The Throwable.
*/
@@ -318,20 +320,23 @@ public interface Logger {
/**
* Logs entry to a method along with its parameters. For example,
+ *
* <pre>
- * public void doSomething(String foo, int bar) {
- * LOGGER.entry(foo, bar);
- * // do something
- * }
+ * public void doSomething(String foo, int bar) {
+ * LOGGER.entry(foo, bar);
+ * // do something
+ * }
* </pre>
- * <p>The use of methods such as this are more effective when combined with aspect-oriented programming or other
- * bytecode manipulation tools. It can be rather tedious (and messy) to use this type of method manually.</p>
+ * <p>
+ * The use of methods such as this are more effective when combined with aspect-oriented programming or other
+ * bytecode manipulation tools. It can be rather tedious (and messy) to use this type of method manually.
+ * </p>
*
- * @param params The parameters to the method.
- * TODO Use of varargs results in array creation which can be a substantial portion of no-op case. LogMF/LogSF
- * provides several overrides to avoid vararg except in edge cases. (RG) LogMF and LogSF implement these in
- * LogXF which calls logger.callAppenders. callAppenders is part of the implementation and cannot be used by
- * the API. Adding more methods here and in AbstractLogger is sufficient.
+ * @param params The parameters to the method. TODO Use of varargs results in array creation which can be a
+ * substantial portion of no-op case. LogMF/LogSF provides several overrides to avoid vararg except in
+ * edge cases. (RG) LogMF and LogSF implement these in LogXF which calls logger.callAppenders.
+ * callAppenders is part of the implementation and cannot be used by the API. Adding more methods here
+ * and in AbstractLogger is sufficient.
*/
void entry(Object... params);
@@ -354,8 +359,8 @@ public interface Logger {
/**
* Logs a message which is only to be constructed if the logging level is the {@link Level#ERROR ERROR} level with
- * the specified Marker.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * the specified Marker. The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the
+ * {@code Message}.
*
* @param marker the marker data specific to this log statement
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -365,8 +370,8 @@ public interface Logger {
/**
* Logs a message (only to be constructed if the logging level is the {@link Level#ERROR ERROR} level) with the
- * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter. The
+ * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param marker the marker data specific to this log statement
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -409,10 +414,10 @@ public interface Logger {
* @param params parameters to the message.
* @see #getMessageFactory()
*
- * TODO 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.
+ * TODO 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);
@@ -476,8 +481,8 @@ public interface Logger {
void error(Message msg, Throwable t);
/**
- * Logs a message which is only to be constructed if the logging level is the {@link Level#ERROR ERROR} level.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * Logs a message which is only to be constructed if the logging level is the {@link Level#ERROR ERROR} level. The
+ * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param msgSupplier A function, which when called, produces the desired log message.
* @since 2.4
@@ -486,8 +491,8 @@ public interface Logger {
/**
* Logs a message (only to be constructed if the logging level is the {@link Level#ERROR ERROR} level) including the
- * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * stack trace of the {@link Throwable} <code>t</code> passed as parameter. The {@code MessageSupplier} may or may
+ * not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param msgSupplier A function, which when called, produces the desired log message.
* @param t the exception to log, including its stack trace.
@@ -525,10 +530,10 @@ public interface Logger {
* @param params parameters to the message.
* @see #getMessageFactory()
*
- * TODO 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.
+ * TODO 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(String message, Object... params);
@@ -578,8 +583,9 @@ public interface Logger {
/**
* Logs exiting from a method with the result. This may be coded as:
+ *
* <pre>
- * return LOGGER.exit(myResult);
+ * return LOGGER.exit(myResult);
* </pre>
*
* @param <R> The type of the parameter and object being returned.
@@ -607,8 +613,8 @@ public interface Logger {
/**
* Logs a message which is only to be constructed if the logging level is the {@link Level#FATAL FATAL} level with
- * the specified Marker.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * the specified Marker. The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the
+ * {@code Message}.
*
* @param marker the marker data specific to this log statement
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -618,8 +624,8 @@ public interface Logger {
/**
* Logs a message (only to be constructed if the logging level is the {@link Level#FATAL FATAL} level) with the
- * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter. The
+ * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param marker the marker data specific to this log statement
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -662,10 +668,10 @@ public interface Logger {
* @param params parameters to the message.
* @see #getMessageFactory()
*
- * TODO 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.
+ * TODO 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);
@@ -729,8 +735,8 @@ public interface Logger {
void fatal(Message msg, Throwable t);
/**
- * Logs a message which is only to be constructed if the logging level is the {@link Level#FATAL FATAL} level.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * Logs a message which is only to be constructed if the logging level is the {@link Level#FATAL FATAL} level. The
+ * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param msgSupplier A function, which when called, produces the desired log message.
* @since 2.4
@@ -739,8 +745,8 @@ public interface Logger {
/**
* Logs a message (only to be constructed if the logging level is the {@link Level#FATAL FATAL} level) including the
- * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * stack trace of the {@link Throwable} <code>t</code> passed as parameter. The {@code MessageSupplier} may or may
+ * not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param msgSupplier A function, which when called, produces the desired log message.
* @param t the exception to log, including its stack trace.
@@ -778,10 +784,10 @@ public interface Logger {
* @param params parameters to the message.
* @see #getMessageFactory()
*
- * TODO 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.
+ * TODO 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(String message, Object... params);
@@ -863,9 +869,9 @@ public interface Logger {
void info(Marker marker, Message msg, Throwable t);
/**
- * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level with
- * the specified Marker.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level with the
+ * specified Marker. The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the
+ * {@code Message}.
*
* @param marker the marker data specific to this log statement
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -875,8 +881,8 @@ public interface Logger {
/**
* Logs a message (only to be constructed if the logging level is the {@link Level#INFO INFO} level) with the
- * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter. The
+ * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param marker the marker data specific to this log statement
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -919,9 +925,9 @@ public interface Logger {
* @param params parameters to the message.
* @see #getMessageFactory()
*
- * TODO 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.
+ * TODO 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);
@@ -985,8 +991,8 @@ public interface Logger {
void info(Message msg, Throwable t);
/**
- * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level. The
+ * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param msgSupplier A function, which when called, produces the desired log message.
* @since 2.4
@@ -995,8 +1001,8 @@ public interface Logger {
/**
* Logs a message (only to be constructed if the logging level is the {@link Level#INFO INFO} level) including the
- * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * stack trace of the {@link Throwable} <code>t</code> passed as parameter. The {@code MessageSupplier} may or may
+ * not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param msgSupplier A function, which when called, produces the desired log message.
* @param t the exception to log, including its stack trace.
@@ -1034,9 +1040,9 @@ public interface Logger {
* @param params parameters to the message.
* @see #getMessageFactory()
*
- * TODO 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.
+ * TODO 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(String message, Object... params);
@@ -1216,9 +1222,9 @@ public interface Logger {
void log(Level level, Marker marker, Message msg, Throwable t);
/**
- * Logs a message which is only to be constructed if the logging level is the specified level with
- * the specified Marker.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * Logs a message which is only to be constructed if the logging level is the specified level with the specified
+ * Marker. The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the
+ * {@code Message}.
*
* @param level the logging level
* @param marker the marker data specific to this log statement
@@ -1228,9 +1234,9 @@ public interface Logger {
void log(Level level, Marker marker, MessageSupplier msgSupplier);
/**
- * Logs a message (only to be constructed if the logging level is the specified level) with the
- * specified Marker and including the stack log of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * Logs a message (only to be constructed if the logging level is the specified level) with the specified Marker and
+ * including the stack log of the {@link Throwable} <code>t</code> passed as parameter. The {@code MessageSupplier}
+ * may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param level the logging level
* @param marker the marker data specific to this log statement
@@ -1260,7 +1266,6 @@ public interface Logger {
*/
void log(Level level, Marker marker, Object message, Throwable t);
-
/**
* Logs a message object with the given level.
*
@@ -1345,8 +1350,8 @@ public interface Logger {
void log(Level level, Message msg, Throwable t);
/**
- * Logs a message which is only to be constructed if the logging level is the specified level.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * Logs a message which is only to be constructed if the logging level is the specified level. The
+ * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param level the logging level
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -1355,9 +1360,9 @@ public interface Logger {
void log(Level level, MessageSupplier msgSupplier);
/**
- * Logs a message (only to be constructed if the logging level is the specified level) including the
- * stack log of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * Logs a message (only to be constructed if the logging level is the specified level) including the stack log of
+ * the {@link Throwable} <code>t</code> passed as parameter. The {@code MessageSupplier} may or may not use the
+ * {@link MessageFactory} to construct the {@code Message}.
*
* @param level the logging level
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -1465,8 +1470,9 @@ public interface Logger {
/**
* Logs an exception or error to be thrown. This may be coded as:
+ *
* <pre>
- * throw logger.throwing(Level.DEBUG, myException);
+ * throw logger.throwing(Level.DEBUG, myException);
* </pre>
*
* @param <T> the Throwable type.
@@ -1478,8 +1484,9 @@ public interface Logger {
/**
* Logs an exception or error to be thrown. This may be coded as:
+ *
* <pre>
- * throw logger.throwing(myException);
+ * throw logger.throwing(myException);
* </pre>
*
* @param <T> the Throwable type.
@@ -1507,8 +1514,8 @@ public interface Logger {
/**
* Logs a message which is only to be constructed if the logging level is the {@link Level#TRACE TRACE} level with
- * the specified Marker.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * the specified Marker. The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the
+ * {@code Message}.
*
* @param marker the marker data specific to this log statement
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -1518,8 +1525,8 @@ public interface Logger {
/**
* Logs a message (only to be constructed if the logging level is the {@link Level#TRACE TRACE} level) with the
- * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter. The
+ * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param marker the marker data specific to this log statement
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -1626,8 +1633,8 @@ public interface Logger {
void trace(Message msg, Throwable t);
/**
- * Logs a message which is only to be constructed if the logging level is the {@link Level#TRACE TRACE} level.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * Logs a message which is only to be constructed if the logging level is the {@link Level#TRACE TRACE} level. The
+ * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param msgSupplier A function, which when called, produces the desired log message.
* @since 2.4
@@ -1636,8 +1643,8 @@ public interface Logger {
/**
* Logs a message (only to be constructed if the logging level is the {@link Level#TRACE TRACE} level) including the
- * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * stack trace of the {@link Throwable} <code>t</code> passed as parameter. The {@code MessageSupplier} may or may
+ * not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param msgSupplier A function, which when called, produces the desired log message.
* @param t the exception to log, including its stack trace.
@@ -1736,9 +1743,9 @@ public interface Logger {
void warn(Marker marker, Message msg, Throwable t);
/**
- * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level with
- * the specified Marker.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level with the
+ * specified Marker. The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the
+ * {@code Message}.
*
* @param marker the marker data specific to this log statement
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -1748,8 +1755,8 @@ public interface Logger {
/**
* Logs a message (only to be constructed if the logging level is the {@link Level#WARN WARN} level) with the
- * specified Marker and including the stack warn of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * specified Marker and including the stack warn of the {@link Throwable} <code>t</code> passed as parameter. The
+ * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param marker the marker data specific to this log statement
* @param msgSupplier A function, which when called, produces the desired log message.
@@ -1792,10 +1799,10 @@ public interface Logger {
* @param params parameters to the message.
* @see #getMessageFactory()
*
- * TODO 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.
+ * TODO 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);
@@ -1859,8 +1866,8 @@ public interface Logger {
void warn(Message msg, Throwable t);
/**
- * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level. The
+ * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param msgSupplier A function, which when called, produces the desired log message.
* @since 2.4
@@ -1869,8 +1876,8 @@ public interface Logger {
/**
* Logs a message (only to be constructed if the logging level is the {@link Level#WARN WARN} level) including the
- * stack warn of the {@link Throwable} <code>t</code> passed as parameter.
- * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+ * stack warn of the {@link Throwable} <code>t</code> passed as parameter. The {@code MessageSupplier} may or may
+ * not use the {@link MessageFactory} to construct the {@code Message}.
*
* @param msgSupplier A function, which when called, produces the desired log message.
* @param t the exception to log, including its stack warn.
@@ -1908,10 +1915,10 @@ public interface Logger {
* @param params parameters to the message.
* @see #getMessageFactory()
*
- * TODO 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.
+ * TODO 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(String message, Object... params);
[19/35] logging-log4j2 git commit: Checkstyle: MagicNumber,
trailing spaces (IDE autoformatted)
Posted by rp...@apache.org.
Checkstyle: MagicNumber, trailing spaces (IDE autoformatted)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/9cf5d4b1
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/9cf5d4b1
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/9cf5d4b1
Branch: refs/heads/master
Commit: 9cf5d4b1f57152461c923b6f847c4a0776c4c8ee
Parents: 898d64e
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:23:52 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:23:52 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9cf5d4b1/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
index 8b84d85..04db82f 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
@@ -129,7 +129,7 @@ public class DefaultThreadContextMap implements ThreadContextMap {
int result = 1;
final Map<String, String> map = this.localMap.get();
result = prime * result + ((map == null) ? 0 : map.hashCode());
- result = prime * result + (this.useMap ? 1231 : 1237);
+ result = prime * result + Boolean.valueOf(this.useMap).hashCode();
return result;
}
[09/35] logging-log4j2 git commit: Checkstyle: LineLength (autoformat)
Posted by rp...@apache.org.
Checkstyle: LineLength (autoformat)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/0aa4384c
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/0aa4384c
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/0aa4384c
Branch: refs/heads/master
Commit: 0aa4384c631f5c7be2e3a6d177c9fec3c4b01b87
Parents: 8dcd64c
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:04:47 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:04:47 2015 +0200
----------------------------------------------------------------------
.../logging/log4j/message/LocalizedMessage.java | 46 ++++++++++----------
1 file changed, 24 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0aa4384c/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java
index c6839b8..32f848d 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java
@@ -57,7 +57,7 @@ public class LocalizedMessage implements Message, LoggerNameAwareMessage {
* Constructor with message pattern and arguments.
*
* @param messagePattern the message pattern that to be checked for placeholders.
- * @param arguments the argument array to be converted.
+ * @param arguments the argument array to be converted.
*/
public LocalizedMessage(final String messagePattern, final Object[] arguments) {
this((ResourceBundle) null, (Locale) null, messagePattern, arguments);
@@ -80,8 +80,7 @@ public class LocalizedMessage implements Message, LoggerNameAwareMessage {
this.locale = locale;
}
- public LocalizedMessage(final ResourceBundle bundle, final Locale locale, final String key,
- final Object[] arguments) {
+ public LocalizedMessage(final ResourceBundle bundle, final Locale locale, final String key, final Object[] arguments) {
this.key = key;
this.argArray = arguments;
this.throwable = null;
@@ -95,57 +94,58 @@ public class LocalizedMessage implements Message, LoggerNameAwareMessage {
}
public LocalizedMessage(final String messagePattern, final Object arg) {
- this((ResourceBundle) null, (Locale) null, messagePattern, new Object[] {arg});
+ this((ResourceBundle) null, (Locale) null, messagePattern, new Object[] { arg });
}
public LocalizedMessage(final String baseName, final String key, final Object arg) {
- this(baseName, (Locale) null, key, new Object[] {arg});
+ this(baseName, (Locale) null, key, new Object[] { arg });
}
public LocalizedMessage(final ResourceBundle bundle, final String key, final Object arg) {
- this(bundle, (Locale) null, key, new Object[] {arg});
+ this(bundle, (Locale) null, key, new Object[] { arg });
}
public LocalizedMessage(final String baseName, final Locale locale, final String key, final Object arg) {
- this(baseName, locale, key, new Object[] {arg});
+ this(baseName, locale, key, new Object[] { arg });
}
public LocalizedMessage(final ResourceBundle bundle, final Locale locale, final String key, final Object arg) {
- this(bundle, locale, key, new Object[] {arg});
+ this(bundle, locale, key, new Object[] { arg });
}
public LocalizedMessage(final Locale locale, final String key, final Object arg) {
- this((ResourceBundle) null, locale, key, new Object[] {arg});
+ this((ResourceBundle) null, locale, key, new Object[] { arg });
}
public LocalizedMessage(final String messagePattern, final Object arg1, final Object arg2) {
- this((ResourceBundle) null, (Locale) null, messagePattern, new Object[] {arg1, arg2});
+ this((ResourceBundle) null, (Locale) null, messagePattern, new Object[] { arg1, arg2 });
}
public LocalizedMessage(final String baseName, final String key, final Object arg1, final Object arg2) {
- this(baseName, (Locale) null, key, new Object[] {arg1, arg2});
+ this(baseName, (Locale) null, key, new Object[] { arg1, arg2 });
}
public LocalizedMessage(final ResourceBundle bundle, final String key, final Object arg1, final Object arg2) {
- this(bundle, (Locale) null, key, new Object[] {arg1, arg2});
+ this(bundle, (Locale) null, key, new Object[] { arg1, arg2 });
}
public LocalizedMessage(final String baseName, final Locale locale, final String key, final Object arg1,
- final Object arg2) {
- this(baseName, locale, key, new Object[] {arg1, arg2});
+ final Object arg2) {
+ this(baseName, locale, key, new Object[] { arg1, arg2 });
}
public LocalizedMessage(final ResourceBundle bundle, final Locale locale, final String key, final Object arg1,
- final Object arg2) {
- this(bundle, locale, key, new Object[] {arg1, arg2});
+ final Object arg2) {
+ this(bundle, locale, key, new Object[] { arg1, arg2 });
}
public LocalizedMessage(final Locale locale, final String key, final Object arg1, final Object arg2) {
- this((ResourceBundle) null, locale, key, new Object[] {arg1, arg2});
+ this((ResourceBundle) null, locale, key, new Object[] { arg1, arg2 });
}
/**
* Set the name of the Logger.
+ *
* @param name The name of the Logger.
*/
@Override
@@ -155,6 +155,7 @@ public class LocalizedMessage implements Message, LoggerNameAwareMessage {
/**
* Returns the name of the Logger.
+ *
* @return the name of the Logger.
*/
@Override
@@ -164,6 +165,7 @@ public class LocalizedMessage implements Message, LoggerNameAwareMessage {
/**
* Returns the formatted message after looking up the format in the resource bundle.
+ *
* @return The formatted message String.
*/
@Override
@@ -180,8 +182,7 @@ public class LocalizedMessage implements Message, LoggerNameAwareMessage {
}
}
final String myKey = getFormat();
- final String msgPattern = (bundle == null || !bundle.containsKey(myKey)) ?
- myKey : bundle.getString(myKey);
+ final String msgPattern = (bundle == null || !bundle.containsKey(myKey)) ? myKey : bundle.getString(myKey);
final Object[] array = argArray == null ? stringArgs : argArray;
final FormattedMessage msg = new FormattedMessage(msgPattern, array);
formattedMessage = msg.getFormattedMessage();
@@ -212,11 +213,12 @@ public class LocalizedMessage implements Message, LoggerNameAwareMessage {
*
* @param rbBaseName The base name of the resource bundle, a fully qualified class name.
* @param resourceBundleLocale The locale to use when formatting the message.
- * @param loop If true the key will be treated as a package or class name and a resource bundle will
- * be located based on all or part of the package name. If false the key is expected to be the exact bundle id.
+ * @param loop If true the key will be treated as a package or class name and a resource bundle will be located
+ * based on all or part of the package name. If false the key is expected to be the exact bundle id.
* @return The ResourceBundle.
*/
- protected ResourceBundle getResourceBundle(final String rbBaseName, final Locale resourceBundleLocale, final boolean loop) {
+ protected ResourceBundle getResourceBundle(final String rbBaseName, final Locale resourceBundleLocale,
+ final boolean loop) {
ResourceBundle rb = null;
if (rbBaseName == null) {
[10/35] logging-log4j2 git commit: Checkstyle: '{' is followed by
whitespace (IDE autoformatted)
Posted by rp...@apache.org.
Checkstyle: '{' is followed by whitespace (IDE autoformatted)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3bb85243
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3bb85243
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3bb85243
Branch: refs/heads/master
Commit: 3bb852434c0583465deff8330fb7b3757078b37e
Parents: 0aa4384
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:06:05 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:06:05 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/message/ObjectMessage.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3bb85243/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
index 834674b..e9a8905 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
@@ -33,6 +33,7 @@ public class ObjectMessage implements Message {
/**
* Creates the ObjectMessage.
+ *
* @param obj The Object to format.
*/
public ObjectMessage(final Object obj) {
@@ -41,6 +42,7 @@ public class ObjectMessage implements Message {
/**
* Returns the formatted object message.
+ *
* @return the formatted object message.
*/
@Override
@@ -54,6 +56,7 @@ public class ObjectMessage implements Message {
/**
* Returns the object formatted using its toString method.
+ *
* @return the String representation of the object.
*/
@Override
@@ -63,6 +66,7 @@ public class ObjectMessage implements Message {
/**
* Returns the object as if it were a parameter.
+ *
* @return The object.
*/
@Override
@@ -82,7 +86,7 @@ public class ObjectMessage implements Message {
final ObjectMessage that = (ObjectMessage) o;
return obj == null ? that.obj == null : equalObjectsOrStrings(obj, that.obj);
}
-
+
private boolean equalObjectsOrStrings(final Object left, final Object right) {
return left.equals(right) || String.valueOf(left).equals(String.valueOf(right));
}
[35/35] logging-log4j2 git commit: Checkstyle:
Posted by rp...@apache.org.
Checkstyle:
- DeclarationOrder, javadoc inner class, IDE autoformat.
- I did not change JDK_7u25_OFFSET to JDK_7U25_OFFSET since it is
package protected.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d64ec448
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d64ec448
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d64ec448
Branch: refs/heads/master
Commit: d64ec448129fa50a6f8267efe188ea81460425d2
Parents: 6ab13dd
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 10:49:39 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 10:49:39 2015 +0200
----------------------------------------------------------------------
.../logging/log4j/util/ReflectionUtil.java | 53 ++++++++++----------
1 file changed, 27 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d64ec448/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
index 6e7a7b8..22d4bc2 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
@@ -23,14 +23,14 @@ import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.status.StatusLogger;
/**
- * <em>Consider this class private.</em> Provides various methods to determine the caller class.
- * <h3>Background</h3>
- * <p>This method, available only in the Oracle/Sun/OpenJDK implementations of the Java
- * Virtual Machine, is a much more efficient mechanism for determining the {@link Class} of the caller of a particular
- * method. When it is not available, a {@link SecurityManager} is the second-best option. When this is also not
- * possible, the {@code StackTraceElement[]} returned by {@link Throwable#getStackTrace()} must be used, and its
- * {@code String} class name converted to a {@code Class} using the slow {@link Class#forName} (which can add an extra
- * microsecond or more for each invocation depending on the runtime ClassLoader hierarchy).
+ * <em>Consider this class private.</em> Provides various methods to determine the caller class. <h3>Background</h3>
+ * <p>
+ * This method, available only in the Oracle/Sun/OpenJDK implementations of the Java Virtual Machine, is a much more
+ * efficient mechanism for determining the {@link Class} of the caller of a particular method. When it is not available,
+ * a {@link SecurityManager} is the second-best option. When this is also not possible, the {@code StackTraceElement[]}
+ * returned by {@link Throwable#getStackTrace()} must be used, and its {@code String} class name converted to a
+ * {@code Class} using the slow {@link Class#forName} (which can add an extra microsecond or more for each invocation
+ * depending on the runtime ClassLoader hierarchy).
* </p>
* <p>
* During Java 8 development, the {@code sun.reflect.Reflection.getCallerClass(int)} was removed from OpenJDK, and this
@@ -41,19 +41,20 @@ import org.apache.logging.log4j.status.StatusLogger;
* <p>
* After much community backlash, the JDK team agreed to restore {@code getCallerClass(int)} and keep its existing
* behavior for the rest of Java 7. However, the method is deprecated in Java 8, and current Java 9 development has not
- * addressed this API. Therefore, the functionality of this class cannot be relied upon for all future versions of
- * Java. It does, however, work just fine in Sun JDK 1.6, OpenJDK 1.6, Oracle/OpenJDK 1.7, and Oracle/OpenJDK 1.8.
- * Other Java environments may fall back to using {@link Throwable#getStackTrace()} which is significantly slower due
- * to examination of every virtual frame of execution.
+ * addressed this API. Therefore, the functionality of this class cannot be relied upon for all future versions of Java.
+ * It does, however, work just fine in Sun JDK 1.6, OpenJDK 1.6, Oracle/OpenJDK 1.7, and Oracle/OpenJDK 1.8. Other Java
+ * environments may fall back to using {@link Throwable#getStackTrace()} which is significantly slower due to
+ * examination of every virtual frame of execution.
* </p>
*/
public final class ReflectionUtil {
+ // Check:OFF: ConstantName
+ static final int JDK_7u25_OFFSET;
+ // Check:ON: ConstantName
private static final Logger LOGGER = StatusLogger.getLogger();
-
private static final boolean SUN_REFLECTION_SUPPORTED;
private static final Method GET_CALLER_CLASS;
- static final int JDK_7u25_OFFSET;
private static final PrivateSecurityManager SECURITY_MANAGER;
static {
@@ -71,16 +72,15 @@ public final class ReflectionUtil {
} else {
o = getCallerClass.invoke(null, 1);
if (o == sunReflectionClass) {
- LOGGER.warn(
- "You are using Java 1.7.0_25 which has a broken implementation of Reflection.getCallerClass.");
+ LOGGER.warn("You are using Java 1.7.0_25 which has a broken implementation of Reflection.getCallerClass.");
LOGGER.warn("You should upgrade to at least Java 1.7.0_40 or later.");
LOGGER.debug("Using stack depth compensation offset of 1 due to Java 7u25.");
java7u25CompensationOffset = 1;
}
}
} catch (final Exception e) {
- LOGGER.info("sun.reflect.Reflection.getCallerClass is not supported. " +
- "ReflectionUtil.getCallerClass will be much slower due to this.", e);
+ LOGGER.info("sun.reflect.Reflection.getCallerClass is not supported. "
+ + "ReflectionUtil.getCallerClass will be much slower due to this.", e);
getCallerClass = null;
java7u25CompensationOffset = -1;
}
@@ -97,13 +97,15 @@ public final class ReflectionUtil {
}
psm = new PrivateSecurityManager();
} catch (final SecurityException ignored) {
- LOGGER.debug(
- "Not allowed to create SecurityManager. Falling back to slowest ReflectionUtil implementation.");
+ LOGGER.debug("Not allowed to create SecurityManager. Falling back to slowest ReflectionUtil implementation.");
psm = null;
}
SECURITY_MANAGER = psm;
}
+ private ReflectionUtil() {
+ }
+
public static boolean supportsFastReflection() {
return SUN_REFLECTION_SUPPORTED;
}
@@ -142,7 +144,7 @@ public final class ReflectionUtil {
static StackTraceElement getEquivalentStackTraceElement(final int depth) {
// (MS) I tested the difference between using Throwable.getStackTrace() and Thread.getStackTrace(), and
- // the version using Throwable was surprisingly faster! at least on Java 1.8. See ReflectionBenchmark.
+ // the version using Throwable was surprisingly faster! at least on Java 1.8. See ReflectionBenchmark.
final StackTraceElement[] elements = new Throwable().getStackTrace();
int i = 0;
for (final StackTraceElement element : elements) {
@@ -242,7 +244,7 @@ public final class ReflectionUtil {
}
try {
return LoaderUtil.loadClass(getCallerClassName(anchor.getName(), Strings.EMPTY,
- new Throwable().getStackTrace()));
+ new Throwable().getStackTrace()));
} catch (final ClassNotFoundException ignored) {
// no problem really
}
@@ -288,6 +290,9 @@ public final class ReflectionUtil {
return new Stack<>();
}
+ /**
+ *
+ */
static final class PrivateSecurityManager extends SecurityManager {
@Override
@@ -323,9 +328,5 @@ public final class ReflectionUtil {
}
return Object.class;
}
-
- }
-
- private ReflectionUtil() {
}
}
[25/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
Empty catch block, LineLength (IDE autoformatted)
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, Empty catch block, LineLength (IDE
autoformatted)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/6f69d24a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/6f69d24a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/6f69d24a
Branch: refs/heads/master
Commit: 6f69d24af92272d51e5aad188904ade4b88c4e04
Parents: 8c9ccfd
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:32:19 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:32:19 2015 +0200
----------------------------------------------------------------------
.../logging/log4j/status/StatusLogger.java | 41 +++++++++++++-------
1 file changed, 26 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6f69d24a/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
index cd96569..fb015f1 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
@@ -42,14 +42,14 @@ import org.apache.logging.log4j.util.Strings;
*/
public final class StatusLogger extends AbstractLogger {
- private static final long serialVersionUID = 2L;
-
/**
- * System property that can be configured with the number of entries in the queue. Once the limit
- * is reached older entries will be removed as new entries are added.
+ * System property that can be configured with the number of entries in the queue. Once the limit is reached older
+ * entries will be removed as new entries are added.
*/
public static final String MAX_STATUS_ENTRIES = "log4j2.status.entries";
+ private static final long serialVersionUID = 2L;
+
private static final String NOT_AVAIL = "?";
private static final PropertiesUtil PROPS = new PropertiesUtil("log4j2.StatusLogger.properties");
@@ -63,25 +63,28 @@ public final class StatusLogger extends AbstractLogger {
private final SimpleLogger logger;
private final Collection<StatusListener> listeners = new CopyOnWriteArrayList<>();
-
- @SuppressWarnings("NonSerializableFieldInSerializableClass") // ReentrantReadWriteLock is Serializable
+
+ @SuppressWarnings("NonSerializableFieldInSerializableClass")
+ // ReentrantReadWriteLock is Serializable
private final ReadWriteLock listenersLock = new ReentrantReadWriteLock();
private final Queue<StatusData> messages = new BoundedQueue<>(MAX_ENTRIES);
-
- @SuppressWarnings("NonSerializableFieldInSerializableClass") // ReentrantLock is Serializable
+
+ @SuppressWarnings("NonSerializableFieldInSerializableClass")
+ // ReentrantLock is Serializable
private final Lock msgLock = new ReentrantLock();
private int listenersLevel;
private StatusLogger() {
- this.logger = new SimpleLogger("StatusLogger", Level.ERROR, false, true, false, false, Strings.EMPTY, null, PROPS,
- System.err);
+ this.logger = new SimpleLogger("StatusLogger", Level.ERROR, false, true, false, false, Strings.EMPTY, null,
+ PROPS, System.err);
this.listenersLevel = Level.toLevel(DEFAULT_STATUS_LEVEL, Level.WARN).intLevel();
}
/**
* Retrieve the StatusLogger.
+ *
* @return The StatusLogger.
*/
public static StatusLogger getLogger() {
@@ -94,6 +97,7 @@ public final class StatusLogger extends AbstractLogger {
/**
* Registers a new listener.
+ *
* @param listener The StatusListener to register.
*/
public void registerListener(final StatusListener listener) {
@@ -111,6 +115,7 @@ public final class StatusLogger extends AbstractLogger {
/**
* Removes a StatusListener.
+ *
* @param listener The StatusListener to remove.
*/
public void removeListener(final StatusListener listener) {
@@ -133,6 +138,7 @@ public final class StatusLogger extends AbstractLogger {
/**
* Returns a thread safe Iterable for the StatusListener.
+ *
* @return An Iterable for the list of StatusListeners.
*/
public Iterable<StatusListener> getListeners() {
@@ -160,11 +166,13 @@ public final class StatusLogger extends AbstractLogger {
try {
resource.close();
} catch (final IOException ignored) {
+ // ignored
}
}
/**
* Returns a List of all events as StatusData objects.
+ *
* @return The list of StatusData objects.
*/
public List<StatusData> getStatusData() {
@@ -195,14 +203,16 @@ public final class StatusLogger extends AbstractLogger {
/**
* Adds an event.
+ *
* @param marker The Marker
- * @param fqcn The fully qualified class name of the <b>caller</b>
- * @param level The logging level
- * @param msg The message associated with the event.
- * @param t A Throwable or null.
+ * @param fqcn The fully qualified class name of the <b>caller</b>
+ * @param level The logging level
+ * @param msg The message associated with the event.
+ * @param t A Throwable or null.
*/
@Override
- public void logMessage(final String fqcn, final Level level, final Marker marker, final Message msg, final Throwable t) {
+ public void logMessage(final String fqcn, final Level level, final Marker marker, final Message msg,
+ final Throwable t) {
StackTraceElement element = null;
if (fqcn != null) {
element = getStackTraceElement(fqcn, Thread.currentThread().getStackTrace());
@@ -279,6 +289,7 @@ public final class StatusLogger extends AbstractLogger {
/**
* Queues for status events.
+ *
* @param <E> Object type to be stored in the queue.
*/
private class BoundedQueue<E> extends ConcurrentLinkedQueue<E> {
[07/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder;
autoformatted
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder; autoformatted
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4432ec27
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4432ec27
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4432ec27
Branch: refs/heads/master
Commit: 4432ec27e7eb3f35cf1c3019526e3346ed1c0d08
Parents: 2891a5d
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 08:59:37 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 08:59:37 2015 +0200
----------------------------------------------------------------------
.../org/apache/logging/log4j/ThreadContext.java | 143 +++++++++++--------
1 file changed, 86 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4432ec27/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java b/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
index bc63663..2b06e79 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
@@ -43,7 +43,7 @@ import org.apache.logging.log4j.util.ProviderUtil;
* the mapped diagnostic context of its parent.
* </p>
*/
-public final class ThreadContext {
+public final class ThreadContext {
/**
* An empty read-only ThreadContextStack.
@@ -95,7 +95,7 @@ public final class ThreadContext {
// Same as java.util.Collections.EmptyList.hashCode()
return 1;
}
-
+
@Override
public ContextStack copy() {
return this;
@@ -149,6 +149,7 @@ public final class ThreadContext {
/**
* An empty iterator. Since Java 1.7 added the Collections.emptyIterator() method, we have to make do.
+ *
* @param <E> the type of the empty iterator
*/
private static class EmptyIterator<E> implements Iterator<E> {
@@ -173,7 +174,8 @@ public final class ThreadContext {
* Empty, immutable Map.
*/
// ironically, this annotation gives an "unsupported @SuppressWarnings" warning in Eclipse
- @SuppressWarnings("PublicStaticCollectionField") // I like irony, so I won't delete it...
+ @SuppressWarnings("PublicStaticCollectionField")
+ // I like irony, so I won't delete it...
public static final Map<String, String> EMPTY_MAP = Collections.emptyMap();
/**
@@ -198,7 +200,11 @@ public final class ThreadContext {
static {
init();
}
-
+
+ private ThreadContext() {
+ // empty
+ }
+
/**
* <em>Consider private, used for testing.</em>
*/
@@ -235,7 +241,7 @@ public final class ThreadContext {
break;
} catch (final Exception e) {
LOGGER.error("Unable to locate or load configured ThreadContextMap {}",
- provider.getThreadContextMap(), e);
+ provider.getThreadContextMap(), e);
contextMap = new DefaultThreadContextMap(useMap);
}
}
@@ -247,17 +253,14 @@ public final class ThreadContext {
}
}
- private ThreadContext() {
- // empty
- }
-
/**
- * Puts a context value (the <code>value</code> parameter) as identified
- * with the <code>key</code> parameter into the current thread's
- * context map.
+ * Puts a context value (the <code>value</code> parameter) as identified with the <code>key</code> parameter into
+ * the current thread's context map.
*
- * <p>If the current thread does not have a context map it is
- * created as a side effect.</p>
+ * <p>
+ * If the current thread does not have a context map it is created as a side effect.
+ * </p>
+ *
* @param key The key name.
* @param value The key value.
*/
@@ -268,7 +271,10 @@ public final class ThreadContext {
/**
* Gets the context value identified by the <code>key</code> parameter.
*
- * <p>This method has no side effects.</p>
+ * <p>
+ * This method has no side effects.
+ * </p>
+ *
* @param key The key to locate.
* @return The value associated with the key or null.
*/
@@ -278,6 +284,7 @@ public final class ThreadContext {
/**
* Removes the context value identified by the <code>key</code> parameter.
+ *
* @param key The key to remove.
*/
public static void remove(final String key) {
@@ -301,6 +308,7 @@ public final class ThreadContext {
/**
* Determines if the key is in the context.
+ *
* @param key The key to locate.
* @return True if the key is in the context, false otherwise.
*/
@@ -310,6 +318,7 @@ public final class ThreadContext {
/**
* Returns a mutable copy of current thread's context Map.
+ *
* @return a mutable copy of the context.
*/
public static Map<String, String> getContext() {
@@ -318,6 +327,7 @@ public final class ThreadContext {
/**
* Returns an immutable view of the current thread's context Map.
+ *
* @return An immutable view of the ThreadContext Map.
*/
public static Map<String, String> getImmutableContext() {
@@ -327,6 +337,7 @@ public final class ThreadContext {
/**
* Returns true if the Map is empty.
+ *
* @return true if the Map is empty, false otherwise.
*/
public static boolean isEmpty() {
@@ -342,6 +353,7 @@ public final class ThreadContext {
/**
* Returns a copy of this thread's stack.
+ *
* @return A copy of this thread's stack.
*/
public static ContextStack cloneStack() {
@@ -350,6 +362,7 @@ public final class ThreadContext {
/**
* Gets an immutable copy of this current thread's context stack.
+ *
* @return an immutable copy of the ThreadContext stack.
*/
public static ContextStack getImmutableStack() {
@@ -359,6 +372,7 @@ public final class ThreadContext {
/**
* Sets this thread's stack.
+ *
* @param stack The stack to use.
*/
public static void setStack(final Collection<String> stack) {
@@ -371,6 +385,7 @@ public final class ThreadContext {
/**
* Gets the current nesting depth of this thread's stack.
+ *
* @return the number of items in the stack.
*
* @see #trim
@@ -382,8 +397,10 @@ public final class ThreadContext {
/**
* Returns the value of the last item placed on the stack.
*
- * <p>The returned value is the value that was pushed last. If no
- * context is available, then the empty string "" is returned.</p>
+ * <p>
+ * The returned value is the value that was pushed last. If no context is available, then the empty string "" is
+ * returned.
+ * </p>
*
* @return String The innermost diagnostic context.
*/
@@ -392,11 +409,12 @@ public final class ThreadContext {
}
/**
- * Looks at the last diagnostic context at the top of this NDC
- * without removing it.
+ * Looks at the last diagnostic context at the top of this NDC without removing it.
*
- * <p>The returned value is the value that was pushed last. If no
- * context is available, then the empty string "" is returned.</p>
+ * <p>
+ * The returned value is the value that was pushed last. If no context is available, then the empty string "" is
+ * returned.
+ * </p>
*
* @return String The innermost diagnostic context.
*/
@@ -407,21 +425,24 @@ public final class ThreadContext {
/**
* Pushes new diagnostic context information for the current thread.
*
- * <p>The contents of the <code>message</code> parameter is
- * determined solely by the client.</p>
+ * <p>
+ * The contents of the <code>message</code> parameter is determined solely by the client.
+ * </p>
*
* @param message The new diagnostic context information.
*/
public static void push(final String message) {
contextStack.push(message);
}
+
/**
* Pushes new diagnostic context information for the current thread.
*
- * <p>The contents of the <code>message</code> and args parameters are
- * determined solely by the client. The message will be treated as a format String
- * and tokens will be replaced with the String value of the arguments in accordance
- * with ParameterizedMessage.</p>
+ * <p>
+ * The contents of the <code>message</code> and args parameters are determined solely by the client. The message
+ * will be treated as a format String and tokens will be replaced with the String value of the arguments in
+ * accordance with ParameterizedMessage.
+ * </p>
*
* @param message The new diagnostic context information.
* @param args Parameters for the message.
@@ -433,50 +454,51 @@ public final class ThreadContext {
/**
* Removes the diagnostic context for this thread.
*
- * <p>Each thread that created a diagnostic context by calling
- * {@link #push} should call this method before exiting. Otherwise,
- * the memory used by the <b>thread</b> cannot be reclaimed by the
- * VM.</p>
+ * <p>
+ * Each thread that created a diagnostic context by calling {@link #push} should call this method before exiting.
+ * Otherwise, the memory used by the <b>thread</b> cannot be reclaimed by the VM.
+ * </p>
*
- * <p>As this is such an important problem in heavy duty systems and
- * because it is difficult to always guarantee that the remove
- * method is called before exiting a thread, this method has been
- * augmented to lazily remove references to dead threads. In
- * practice, this means that you can be a little sloppy and
- * occasionally forget to call {@link #remove} before exiting a
- * thread. However, you must call <code>remove</code> sometime. If
- * you never call it, then your application is sure to run out of
- * memory.</p>
+ * <p>
+ * As this is such an important problem in heavy duty systems and because it is difficult to always guarantee that
+ * the remove method is called before exiting a thread, this method has been augmented to lazily remove references
+ * to dead threads. In practice, this means that you can be a little sloppy and occasionally forget to call
+ * {@link #remove} before exiting a thread. However, you must call <code>remove</code> sometime. If you never call
+ * it, then your application is sure to run out of memory.
+ * </p>
*/
public static void removeStack() {
contextStack.clear();
}
/**
- * Trims elements from this diagnostic context. If the current
- * depth is smaller or equal to <code>maxDepth</code>, then no
- * action is taken. If the current depth is larger than newDepth
- * then all elements at maxDepth or higher are discarded.
+ * Trims elements from this diagnostic context. If the current depth is smaller or equal to <code>maxDepth</code>,
+ * then no action is taken. If the current depth is larger than newDepth then all elements at maxDepth or higher are
+ * discarded.
*
- * <p>This method is a convenient alternative to multiple {@link
- * #pop} calls. Moreover, it is often the case that at the end of
- * complex call sequences, the depth of the ThreadContext is
- * unpredictable. The <code>trim</code> method circumvents
- * this problem.</p>
+ * <p>
+ * This method is a convenient alternative to multiple {@link #pop} calls. Moreover, it is often the case that at
+ * the end of complex call sequences, the depth of the ThreadContext is unpredictable. The <code>trim</code> method
+ * circumvents this problem.
+ * </p>
*
- * <p>For example, the combination</p>
+ * <p>
+ * For example, the combination
+ * </p>
+ *
* <pre>
* void foo() {
* final int depth = ThreadContext.getDepth();
- *
+ *
* // ... complex sequence of calls
- *
+ *
* ThreadContext.trim(depth);
* }
* </pre>
*
- * <p>ensures that between the entry and exit of {@code foo} the depth of the
- * diagnostic stack is conserved.</p>
+ * <p>
+ * ensures that between the entry and exit of {@code foo} the depth of the diagnostic stack is conserved.
+ * </p>
*
* @see #getDepth
* @param depth The number of elements to keep.
@@ -492,6 +514,7 @@ public final class ThreadContext {
/**
* Returns the element at the top of the stack.
+ *
* @return The element at the top of the stack.
* @throws java.util.NoSuchElementException if the stack is empty.
*/
@@ -499,44 +522,50 @@ public final class ThreadContext {
/**
* Returns the element at the top of the stack without removing it or null if the stack is empty.
+ *
* @return the element at the top of the stack or null if the stack is empty.
*/
String peek();
/**
* Pushes an element onto the stack.
+ *
* @param message The element to add.
*/
void push(String message);
/**
* Returns the number of elements in the stack.
+ *
* @return the number of elements in the stack.
*/
int getDepth();
/**
* Returns all the elements in the stack in a List.
+ *
* @return all the elements in the stack in a List.
*/
List<String> asList();
/**
* Trims elements from the end of the stack.
+ *
* @param depth The maximum number of items in the stack to keep.
*/
void trim(int depth);
/**
* Returns a copy of the ContextStack.
+ *
* @return a copy of the ContextStack.
*/
ContextStack copy();
/**
- * Returns a ContextStack with the same contents as this ContextStack or {@code null}.
- * Attempts to modify the returned stack may or may not throw an exception, but will not affect the contents
- * of this ContextStack.
+ * Returns a ContextStack with the same contents as this ContextStack or {@code null}. Attempts to modify the
+ * returned stack may or may not throw an exception, but will not affect the contents of this ContextStack.
+ *
* @return a ContextStack with the same contents as this ContextStack or {@code null}.
*/
ContextStack getImmutableStackOrNull();
[32/35] logging-log4j2 git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/logging-log4j2.git
Posted by rp...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/logging-log4j2.git
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4b3296c1
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4b3296c1
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4b3296c1
Branch: refs/heads/master
Commit: 4b3296c10184f27cf223141d14f27c8986fa0a9b
Parents: 5f80bf6 47f70fe
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 10:37:35 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 10:37:35 2015 +0200
----------------------------------------------------------------------
.../log4j/core/async/AsyncLoggerConfig.java | 4 +-
.../core/config/AbstractConfiguration.java | 9 +-
.../logging/log4j/core/config/LoggerConfig.java | 8 +-
.../impl/DefaultConfigurationBuilder.java | 3 +-
.../core/config/json/JsonConfiguration.java | 5 +-
.../core/config/plugins/util/PluginBuilder.java | 1 -
.../PropertiesConfigurationFactory.java | 3 +-
.../logging/log4j/core/impl/Log4jLogEvent.java | 3 +-
.../logging/log4j/core/layout/HtmlLayout.java | 3 +-
.../nosql/appender/AbstractNoSqlConnection.java | 48 ++
.../appender/couchdb/CouchDbConnection.java | 145 +++---
.../appender/mongodb/MongoDbConnection.java | 51 +--
.../nosql/appender/mongodb/MongoDbProvider.java | 48 +-
.../log4j/nosql/appender/MongoDbAuthTest.java | 37 ++
.../src/test/resources/log4j2-mongodb-auth.xml | 30 ++
pom.xml | 2 +-
src/changes/changes.xml | 9 +-
src/site/xdoc/manual/plugins.xml | 456 +++++++++----------
18 files changed, 475 insertions(+), 390 deletions(-)
----------------------------------------------------------------------
[22/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
IDE autoformatted
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, IDE autoformatted
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/75e6c12a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/75e6c12a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/75e6c12a
Branch: refs/heads/master
Commit: 75e6c12ae4ec26c5bf14f8ce6179f926efd7b94a
Parents: caa5a6e
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:27:31 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:27:31 2015 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/logging/log4j/spi/Provider.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/75e6c12a/log4j-api/src/main/java/org/apache/logging/log4j/spi/Provider.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/Provider.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/Provider.java
index 69c2a78..cd54d43 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/Provider.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/Provider.java
@@ -28,7 +28,6 @@ import org.apache.logging.log4j.status.StatusLogger;
* not be used by providers.
*/
public class Provider {
- private static final Integer DEFAULT_PRIORITY = Integer.valueOf(-1);
/**
* Property name to set for a Log4j 2 provider to specify the priority of this implementation.
*/
@@ -42,6 +41,7 @@ public class Provider {
*/
public static final String LOGGER_CONTEXT_FACTORY = "LoggerContextFactory";
+ private static final Integer DEFAULT_PRIORITY = Integer.valueOf(-1);
private static final Logger LOGGER = StatusLogger.getLogger();
private final Integer priority;
@@ -99,8 +99,7 @@ public class Provider {
}
/**
- * Gets the class name of the {@link org.apache.logging.log4j.spi.ThreadContextMap} implementation of this
- * Provider.
+ * Gets the class name of the {@link org.apache.logging.log4j.spi.ThreadContextMap} implementation of this Provider.
*
* @return the class name of a ThreadContextMap implementation
*/
[06/35] logging-log4j2 git commit: Checkstyle: 'parents' hides field,
cast not followed by whitespace, LineLength (IDE autoformatted)
Posted by rp...@apache.org.
Checkstyle: 'parents' hides field, cast not followed by whitespace,
LineLength (IDE autoformatted)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2891a5d4
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2891a5d4
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2891a5d4
Branch: refs/heads/master
Commit: 2891a5d46739dada889905bd325463a26c429f5a
Parents: 2898bcb
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 08:57:30 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 08:57:30 2015 +0200
----------------------------------------------------------------------
.../org/apache/logging/log4j/MarkerManager.java | 37 +++++++++++---------
1 file changed, 20 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2891a5d4/log4j-api/src/main/java/org/apache/logging/log4j/MarkerManager.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/MarkerManager.java b/log4j-api/src/main/java/org/apache/logging/log4j/MarkerManager.java
index 850dff1..320eb84 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/MarkerManager.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/MarkerManager.java
@@ -20,10 +20,8 @@ import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-
/**
- * Applications create Markers by using the Marker Manager. All Markers created by this Manager are
- * immutable.
+ * Applications create Markers by using the Marker Manager. All Markers created by this Manager are immutable.
*/
public final class MarkerManager {
@@ -42,6 +40,7 @@ public final class MarkerManager {
/**
* Tests existence of the given marker.
+ *
* @param key the marker name
* @return true if the marker exists.
* @since 2.4
@@ -50,9 +49,9 @@ public final class MarkerManager {
return MARKERS.containsKey(key);
}
-
/**
* Retrieves a Marker or create a Marker that has no parent.
+ *
* @param name The name of the Marker.
* @return The Marker with the specified name.
* @throws IllegalArgumentException if the argument is {@code null}
@@ -64,6 +63,7 @@ public final class MarkerManager {
/**
* Retrieves or creates a Marker with the specified parent. The parent must have been previously created.
+ *
* @param name The name of the Marker.
* @param parent The name of the parent Marker.
* @return The Marker with the specified name.
@@ -83,6 +83,7 @@ public final class MarkerManager {
/**
* Retrieves or creates a Marker with the specified parent.
+ *
* @param name The name of the Marker.
* @param parent The parent Marker.
* @return The Marker with the specified name.
@@ -125,6 +126,7 @@ public final class MarkerManager {
/**
* Constructs a new Marker.
+ *
* @param name the name of the Marker.
* @throws IllegalArgumentException if the argument is {@code null}
*/
@@ -141,8 +143,8 @@ public final class MarkerManager {
// TODO: use java.util.concurrent
@Override
- public synchronized Marker addParents(final Marker... parents) {
- if (parents == null) {
+ public synchronized Marker addParents(final Marker... parentMarkers) {
+ if (parentMarkers == null) {
throw new IllegalArgumentException("A parent marker must be specified");
}
// It is not strictly necessary to copy the variable here but it should perform better than
@@ -150,9 +152,9 @@ public final class MarkerManager {
final Marker[] localParents = this.parents;
// Don't add a parent that is already in the hierarchy.
int count = 0;
- int size = parents.length;
+ int size = parentMarkers.length;
if (localParents != null) {
- for (final Marker parent : parents) {
+ for (final Marker parent : parentMarkers) {
if (!(contains(parent, localParents) || parent.isInstanceOf(this))) {
++count;
}
@@ -165,11 +167,11 @@ public final class MarkerManager {
final Marker[] markers = new Marker[size];
if (localParents != null) {
// It's perfectly OK to call arraycopy in a synchronized context; it's still faster
- //noinspection CallToNativeMethodWhileLocked
+ // noinspection CallToNativeMethodWhileLocked
System.arraycopy(localParents, 0, markers, 0, localParents.length);
}
int index = localParents == null ? 0 : localParents.length;
- for (final Marker parent : parents) {
+ for (final Marker parent : parentMarkers) {
if (localParents == null || !(contains(parent, localParents) || parent.isInstanceOf(this))) {
markers[index++] = parent;
}
@@ -197,7 +199,7 @@ public final class MarkerManager {
}
int index = 0;
final Marker[] markers = new Marker[localParentsLength - 1];
- //noinspection ForLoopReplaceableByForEach
+ // noinspection ForLoopReplaceableByForEach
for (int i = 0; i < localParentsLength; i++) {
final Marker marker = localParents[i];
if (!marker.equals(parent)) {
@@ -260,7 +262,7 @@ public final class MarkerManager {
if (localParentsLength == 2) {
return checkParent(localParents[0], marker) || checkParent(localParents[1], marker);
}
- //noinspection ForLoopReplaceableByForEach
+ // noinspection ForLoopReplaceableByForEach
for (int i = 0; i < localParentsLength; i++) {
final Marker localParent = localParents[i];
if (checkParent(localParent, marker)) {
@@ -293,7 +295,7 @@ public final class MarkerManager {
if (localParentsLength == 2) {
return checkParent(localParents[0], marker) || checkParent(localParents[1], marker);
}
- //noinspection ForLoopReplaceableByForEach
+ // noinspection ForLoopReplaceableByForEach
for (int i = 0; i < localParentsLength; i++) {
final Marker localParent = localParents[i];
if (checkParent(localParent, marker)) {
@@ -309,7 +311,8 @@ public final class MarkerManager {
if (parent == marker) {
return true;
}
- final Marker[] localParents = parent instanceof Log4jMarker ? ((Log4jMarker)parent).parents : parent.getParents();
+ final Marker[] localParents = parent instanceof Log4jMarker ? ((Log4jMarker) parent).parents : parent
+ .getParents();
if (localParents != null) {
final int localParentsLength = localParents.length;
if (localParentsLength == 1) {
@@ -318,7 +321,7 @@ public final class MarkerManager {
if (localParentsLength == 2) {
return checkParent(localParents[0], marker) || checkParent(localParents[1], marker);
}
- //noinspection ForLoopReplaceableByForEach
+ // noinspection ForLoopReplaceableByForEach
for (int i = 0; i < localParentsLength; i++) {
final Marker localParent = localParents[i];
if (checkParent(localParent, marker)) {
@@ -333,7 +336,7 @@ public final class MarkerManager {
* Called from add while synchronized.
*/
private static boolean contains(final Marker parent, final Marker... localParents) {
- //noinspection ForLoopReplaceableByForEach
+ // noinspection ForLoopReplaceableByForEach
// performance tests showed a normal for loop is slightly faster than a for-each loop on some platforms
for (int i = 0, localParentsLength = localParents.length; i < localParentsLength; i++) {
final Marker marker = localParents[i];
@@ -375,7 +378,7 @@ public final class MarkerManager {
private static void addParentInfo(final StringBuilder sb, final Marker... parents) {
sb.append("[ ");
boolean first = true;
- //noinspection ForLoopReplaceableByForEach
+ // noinspection ForLoopReplaceableByForEach
for (int i = 0, parentsLength = parents.length; i < parentsLength; i++) {
final Marker marker = parents[i];
if (!first) {
[23/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
ConstantName, IDE autoformatted
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, ConstantName, IDE autoformatted
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3d335e7c
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3d335e7c
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3d335e7c
Branch: refs/heads/master
Commit: 3d335e7ccd45b5cefae4edad8fbbe4657d81af80
Parents: 75e6c12
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:29:07 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:29:07 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/spi/StandardLevel.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3d335e7c/log4j-api/src/main/java/org/apache/logging/log4j/spi/StandardLevel.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/StandardLevel.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/StandardLevel.java
index 59b0e5a..e8c1d6c 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/StandardLevel.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/StandardLevel.java
@@ -19,8 +19,7 @@ package org.apache.logging.log4j.spi;
import java.util.EnumSet;
/**
- * Standard Logging Levels as an enumeration for use internally. This enum is used as a parameter in
- * any public APIs.
+ * Standard Logging Levels as an enumeration for use internally. This enum is used as a parameter in any public APIs.
*/
public enum StandardLevel {
@@ -64,17 +63,17 @@ public enum StandardLevel {
*/
ALL(Integer.MAX_VALUE);
+ private static final EnumSet<StandardLevel> LEVELSET = EnumSet.allOf(StandardLevel.class);
private final int intLevel;
- private static final EnumSet<StandardLevel> levelSet = EnumSet.allOf(StandardLevel.class);
-
private StandardLevel(final int val) {
intLevel = val;
}
/**
* Returns the integer value of the Level.
+ *
* @return the integer value of the Level.
*/
public int intLevel() {
@@ -83,12 +82,13 @@ public enum StandardLevel {
/**
* Method to convert custom Levels into a StandardLevel for conversion to other systems.
+ *
* @param intLevel The integer value of the Level.
* @return The StandardLevel.
*/
public static StandardLevel getStandardLevel(final int intLevel) {
StandardLevel level = StandardLevel.OFF;
- for (final StandardLevel lvl : levelSet) {
+ for (final StandardLevel lvl : LEVELSET) {
if (lvl.intLevel() > intLevel) {
break;
}
[13/35] logging-log4j2 git commit: Checkstyle: DeclarationOrder,
'enterpriseNumber' hides field, IDE autoformatted
Posted by rp...@apache.org.
Checkstyle: DeclarationOrder, 'enterpriseNumber' hides field, IDE
autoformatted
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/111ea364
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/111ea364
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/111ea364
Branch: refs/heads/master
Commit: 111ea364e0dab3726de23c4a9c469dc3430b5b40
Parents: ac42b6a
Author: rpopma <rp...@apache.org>
Authored: Thu Sep 24 09:10:46 2015 +0200
Committer: rpopma <rp...@apache.org>
Committed: Thu Sep 24 09:10:46 2015 +0200
----------------------------------------------------------------------
.../logging/log4j/message/StructuredDataId.java | 39 +++++++++++---------
1 file changed, 22 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/111ea364/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java
index 606d16e..2bbb9a2 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java
@@ -25,25 +25,23 @@ import org.apache.logging.log4j.util.Strings;
*/
public class StructuredDataId implements Serializable {
- private static final String AT_SIGN = "@";
-
/**
* RFC 5424 Time Quality.
*/
- public static final StructuredDataId TIME_QUALITY = new StructuredDataId("timeQuality", null,
- new String[]{"tzKnown", "isSynced", "syncAccuracy"});
+ public static final StructuredDataId TIME_QUALITY = new StructuredDataId("timeQuality", null, new String[] {
+ "tzKnown", "isSynced", "syncAccuracy" });
/**
* RFC 5424 Origin.
*/
- public static final StructuredDataId ORIGIN = new StructuredDataId("origin", null,
- new String[]{"ip", "enterpriseId", "software", "swVersion"});
+ public static final StructuredDataId ORIGIN = new StructuredDataId("origin", null, new String[] { "ip",
+ "enterpriseId", "software", "swVersion" });
/**
* RFC 5424 Meta.
*/
- public static final StructuredDataId META = new StructuredDataId("meta", null,
- new String[]{"sequenceId", "sysUpTime", "language"});
+ public static final StructuredDataId META = new StructuredDataId("meta", null, new String[] { "sequenceId",
+ "sysUpTime", "language" });
/**
* Reserved enterprise number.
@@ -52,13 +50,13 @@ public class StructuredDataId implements Serializable {
private static final long serialVersionUID = 9031746276396249990L;
private static final int MAX_LENGTH = 32;
+ private static final String AT_SIGN = "@";
private final String name;
private final int enterpriseNumber;
private final String[] required;
private final String[] optional;
-
protected StructuredDataId(final String name, final String[] required, final String[] optional) {
int index = -1;
if (name != null) {
@@ -83,13 +81,13 @@ public class StructuredDataId implements Serializable {
/**
* A Constructor that helps conformance to RFC 5424.
*
- * @param name The name portion of the id.
+ * @param name The name portion of the id.
* @param enterpriseNumber The enterprise number.
- * @param required The list of keys that are required for this id.
- * @param optional The list of keys that are optional for this id.
+ * @param required The list of keys that are required for this id.
+ * @param optional The list of keys that are optional for this id.
*/
public StructuredDataId(final String name, final int enterpriseNumber, final String[] required,
- final String[] optional) {
+ final String[] optional) {
if (name == null) {
throw new IllegalArgumentException("No structured id name was supplied");
}
@@ -111,6 +109,7 @@ public class StructuredDataId implements Serializable {
/**
* Creates an id using another id to supply default values.
+ *
* @param id The original StructuredDataId.
* @return the new StructuredDataId.
*/
@@ -123,15 +122,16 @@ public class StructuredDataId implements Serializable {
/**
* Creates an id based on the current id.
+ *
* @param defaultId The default id to use if this StructuredDataId doesn't have a name.
- * @param enterpriseNumber The enterprise number.
+ * @param anEnterpriseNumber The enterprise number.
* @return a StructuredDataId.
*/
- public StructuredDataId makeId(final String defaultId, final int enterpriseNumber) {
+ public StructuredDataId makeId(final String defaultId, final int anEnterpriseNumber) {
String id;
String[] req;
String[] opt;
- if (enterpriseNumber <= 0) {
+ if (anEnterpriseNumber <= 0) {
return this;
}
if (this.name != null) {
@@ -144,11 +144,12 @@ public class StructuredDataId implements Serializable {
opt = null;
}
- return new StructuredDataId(id, enterpriseNumber, req, opt);
+ return new StructuredDataId(id, anEnterpriseNumber, req, opt);
}
/**
* Returns a list of required keys.
+ *
* @return a List of required keys or null if none have been provided.
*/
public String[] getRequired() {
@@ -157,6 +158,7 @@ public class StructuredDataId implements Serializable {
/**
* Returns a list of optional keys.
+ *
* @return a List of optional keys or null if none have been provided.
*/
public String[] getOptional() {
@@ -165,6 +167,7 @@ public class StructuredDataId implements Serializable {
/**
* Returns the StructuredDataId name.
+ *
* @return the StructuredDataId name.
*/
public String getName() {
@@ -173,6 +176,7 @@ public class StructuredDataId implements Serializable {
/**
* Returns the enterprise number.
+ *
* @return the enterprise number.
*/
public int getEnterpriseNumber() {
@@ -181,6 +185,7 @@ public class StructuredDataId implements Serializable {
/**
* Indicates if the id is reserved.
+ *
* @return true if the id uses the reserved enterprise number, false otherwise.
*/
public boolean isReserved() {