Skip to content

Commit

Permalink
Ensure Spring LogFactory contains all public methods from Apache LogF…
Browse files Browse the repository at this point in the history
…actory

Closes gh-30668
  • Loading branch information
jhoeller committed Jun 21, 2023
1 parent 26f0065 commit 20bbebb
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -102,4 +102,47 @@ public Log getInstance(String name) {
return getLog(name);
}


// Just in case some code happens to call uncommon Commons Logging methods...

@Deprecated
public Object getAttribute(String name) {
return null;
}

@Deprecated
public String[] getAttributeNames() {
return new String[0];
}

@Deprecated
public void removeAttribute(String name) {
// do nothing
}

@Deprecated
public void setAttribute(String name, Object value) {
// do nothing
}

@Deprecated
public void release() {
// do nothing
}

@Deprecated
public static void release(ClassLoader classLoader) {
// do nothing
}

@Deprecated
public static void releaseAll() {
// do nothing
}

@Deprecated
public static String objectId(Object o) {
return (o == null ? "null" : o.getClass().getName() + "@" + System.identityHashCode(o));
}

}
Expand Up @@ -53,8 +53,9 @@ public Log getInstance(String name) {
}


// Just in case some code happens to call uncommon Commons Logging methods...
// Just in case some code happens to rely on Commons Logging attributes...

@Override
public void setAttribute(String name, Object value) {
if (value != null) {
this.attributes.put(name, value);
Expand All @@ -64,19 +65,19 @@ public void setAttribute(String name, Object value) {
}
}

@Override
public void removeAttribute(String name) {
this.attributes.remove(name);
}

@Override
public Object getAttribute(String name) {
return this.attributes.get(name);
}

@Override
public String[] getAttributeNames() {
return this.attributes.keySet().toArray(new String[0]);
}

public void release() {
}

}

0 comments on commit 20bbebb

Please sign in to comment.