diff --git a/spring-jcl/src/main/java/org/apache/commons/logging/LogFactoryService.java b/spring-jcl/src/main/java/org/apache/commons/logging/LogFactoryService.java index 4c771ba0b49..f9f88ce934d 100644 --- a/spring-jcl/src/main/java/org/apache/commons/logging/LogFactoryService.java +++ b/spring-jcl/src/main/java/org/apache/commons/logging/LogFactoryService.java @@ -16,6 +16,9 @@ package org.apache.commons.logging; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + /** * A minimal subclass of the standard Apache Commons Logging's {@code LogFactory} class, * overriding the abstract {@code getInstance} lookup methods. This is just applied in @@ -30,6 +33,9 @@ package org.apache.commons.logging; @Deprecated public class LogFactoryService extends LogFactory { + private final Map attributes = new ConcurrentHashMap<>(); + + @Override public Log getInstance(Class clazz) { return getInstance(clazz.getName()); @@ -41,7 +47,29 @@ public class LogFactoryService extends LogFactory { } - // Just in case some code happens to call Commons Logging's LogFactory.release() + // Just in case some code happens to call uncommon Commons Logging methods... + + public void setAttribute(String name, Object value) { + if (value != null) { + this.attributes.put(name, value); + } + else { + this.attributes.remove(name); + } + } + + public void removeAttribute(String name) { + this.attributes.remove(name); + } + + public Object getAttribute(String name) { + return this.attributes.get(name); + } + + public String[] getAttributeNames() { + return this.attributes.keySet().toArray(new String[0]); + } + public void release() { }