LogFactoryService implements Commons Logging attribute methods
Issue: SPR-17302
This commit is contained in:
parent
333e327289
commit
d6dfde3e5b
|
|
@ -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<String, Object> 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() {
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue