This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/main by this push:
new b5d3cea6ec Port changes from `2.x` irrelevant to code (log4j-1.2-api)
b5d3cea6ec is described below
commit b5d3cea6ec3ecc4847be98ca7c92652f3c3b4021
Author: Piotr P. Karwasz <[email protected]>
AuthorDate: Wed Mar 29 23:44:44 2023 +0200
Port changes from `2.x` irrelevant to code (log4j-1.2-api)
Ports Javadoc changes and removes unused private methods.
---
.../src/main/java/org/apache/log4j/Category.java | 2 -
.../src/main/java/org/apache/log4j/Hierarchy.java | 81 ----------------------
.../builders/filter/LevelRangeFilterBuilder.java | 5 +-
.../java/org/apache/log4j/spi/ErrorHandler.java | 5 --
4 files changed, 4 insertions(+), 89 deletions(-)
diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/Category.java
b/log4j-1.2-api/src/main/java/org/apache/log4j/Category.java
index c35a2cc74e..af8022f77a 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/Category.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/Category.java
@@ -174,12 +174,10 @@ public class Category implements AppenderAttachable {
this.name = name;
this.logger = context.getLogger(name);
this.repository = LogManager.getLoggerRepository();
- // this.rendererMap = ((RendererSupport) repository).getRendererMap();
}
Category(final org.apache.logging.log4j.Logger logger) {
this.logger = logger;
- // rendererMap = ((RendererSupport)
LogManager.getLoggerRepository()).getRendererMap();
}
/**
diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/Hierarchy.java
b/log4j-1.2-api/src/main/java/org/apache/log4j/Hierarchy.java
index a40b33bd53..5057112b38 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/Hierarchy.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/Hierarchy.java
@@ -522,85 +522,4 @@ public class Hierarchy implements LoggerRepository,
RendererSupport, ThrowableRe
}
}
- /**
- * We update the links for all the children that placed themselves in the
provision node 'pn'. The second argument 'cat'
- * is a reference for the newly created Logger, parent of all the children
in 'pn'
- *
- * We loop on all the children 'c' in 'pn':
- *
- * If the child 'c' has been already linked to a child of 'cat' then there
is no need to update 'c'.
- *
- * Otherwise, we set cat's parent field to c's parent and set c's parent
field to cat.
- *
- */
- final private void updateChildren(final ProvisionNode pn, final Logger
logger) {
- // System.out.println("updateChildren called for " + logger.name);
- final int last = pn.size();
-
- for (int i = 0; i < last; i++) {
- final Logger l = (Logger) pn.elementAt(i);
- // System.out.println("Updating child " +p.name);
-
- // Unless this child already points to a correct (lower) parent,
- // make cat.parent point to l.parent and l.parent to cat.
- if (!l.parent.name.startsWith(logger.name)) {
- logger.parent = l.parent;
- l.parent = logger;
- }
- }
- }
-
- /**
- * This method loops through all the *potential* parents of 'cat'. There 3
possible cases:
- *
- * 1) No entry for the potential parent of 'cat' exists
- *
- * We create a ProvisionNode for this potential parent and insert 'cat' in
that provision node.
- *
- * 2) There entry is of type Logger for the potential parent.
- *
- * The entry is 'cat's nearest existing parent. We update cat's parent
field with this entry. We also break from the
- * loop because updating our parent's parent is our parent's
responsibility.
- *
- * 3) There entry is of type ProvisionNode for this potential parent.
- *
- * We add 'cat' to the list of children for this potential parent.
- */
- final private void updateParents(final Logger cat) {
- final String name = cat.name;
- final int length = name.length();
- boolean parentFound = false;
-
- // System.out.println("UpdateParents called for " + name);
-
- // if name = "w.x.y.z", loop thourgh "w.x.y", "w.x" and "w", but not
"w.x.y.z"
- for (int i = name.lastIndexOf('.', length - 1); i >= 0; i =
name.lastIndexOf('.', i - 1)) {
- final String substr = name.substring(0, i);
-
- // System.out.println("Updating parent : " + substr);
- final CategoryKey key = new CategoryKey(substr); // simple
constructor
- final Object o = ht.get(key);
- // Create a provision node for a future parent.
- if (o == null) {
- // System.out.println("No parent "+substr+" found. Creating
ProvisionNode.");
- final ProvisionNode pn = new ProvisionNode(cat);
- ht.put(key, pn);
- } else if (o instanceof Category) {
- parentFound = true;
- cat.parent = (Category) o;
- // System.out.println("Linking " + cat.name + " -> " +
((Category) o).name);
- break; // no need to update the ancestors of the closest
ancestor
- } else if (o instanceof ProvisionNode) {
- ((ProvisionNode) o).addElement(cat);
- } else {
- final Exception e = new IllegalStateException("unexpected
object type " + o.getClass() + " in ht.");
- e.printStackTrace();
- }
- }
- // If we could not find any existing parents, then link with root.
- if (!parentFound) {
- cat.parent = root;
- }
- }
-
}
diff --git
a/log4j-1.2-api/src/main/java/org/apache/log4j/builders/filter/LevelRangeFilterBuilder.java
b/log4j-1.2-api/src/main/java/org/apache/log4j/builders/filter/LevelRangeFilterBuilder.java
index 7219ed2538..29ce2f72fa 100644
---
a/log4j-1.2-api/src/main/java/org/apache/log4j/builders/filter/LevelRangeFilterBuilder.java
+++
b/log4j-1.2-api/src/main/java/org/apache/log4j/builders/filter/LevelRangeFilterBuilder.java
@@ -36,7 +36,10 @@ import static
org.apache.log4j.builders.BuilderManager.NAMESPACE;
import static org.apache.log4j.xml.XmlConfiguration.forEachElement;
/**
- * Build a Level match filter.
+ * Build a Level range filter.
+ * In this class, order of {@link Level} is log4j1 way, i.e.,
+ * {@link Level#ALL} and {@link Level#OFF} have minimum and maximum order,
respectively.
+ * (see: LOG4J2-2315)
*/
@Namespace(NAMESPACE)
@Plugin("org.apache.log4j.varia.LevelRangeFilter")
diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/spi/ErrorHandler.java
b/log4j-1.2-api/src/main/java/org/apache/log4j/spi/ErrorHandler.java
index f3b11f9516..18c6911e80 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/spi/ErrorHandler.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/spi/ErrorHandler.java
@@ -27,11 +27,6 @@ import org.apache.log4j.Logger;
* Error handling is a particularly tedious to get right because by
* definition errors are hard to predict and to reproduce.
* </p>
- * <p>
- * Please take the time to contact the author in case you discover
- * that errors are not properly handled. You are most welcome to
- * suggest new error handling policies or criticize existing policies.
- * </p>
*/
public interface ErrorHandler {