Author: asoldano
Date: Wed Nov 7 16:34:55 2012
New Revision: 1406710
URL: http://svn.apache.org/viewvc?rev=1406710&view=rev
Log:
Fix regression cause by commit 1404620 causing Log4J logger not being used
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java?rev=1406710&r1=1406709&r2=1406710&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java
(original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java Wed
Nov 7 16:34:55 2012
@@ -237,22 +237,23 @@ public final class LogUtils {
if (n != null) {
Thread.currentThread().setContextClassLoader(n);
}
+ String bundleName = name;
try {
Logger logger = null;
ResourceBundle b = null;
- if (name == null) {
+ if (bundleName == null) {
//grab the bundle prior to the call to Logger.getLogger(...)
so the
//ResourceBundle can be loaded outside the big sync block that
getLogger really is
- name = BundleUtils.getBundleName(cls);
+ bundleName = BundleUtils.getBundleName(cls);
try {
b = BundleUtils.getBundle(cls);
} catch (MissingResourceException rex) {
//ignore
}
} else {
- name = BundleUtils.getBundleName(cls, name);
+ bundleName = BundleUtils.getBundleName(cls, bundleName);
try {
- b = BundleUtils.getBundle(cls, name);
+ b = BundleUtils.getBundle(cls, bundleName);
} catch (MissingResourceException rex) {
//ignore
}
@@ -266,7 +267,7 @@ public final class LogUtils {
Constructor<?> cns =
loggerClass.getConstructor(String.class, String.class);
if (name == null) {
try {
- return (Logger) cns.newInstance(loggerName,
BundleUtils.getBundleName(cls));
+ return (Logger) cns.newInstance(loggerName,
bundleName);
} catch (InvocationTargetException ite) {
if (ite.getTargetException() instanceof
MissingResourceException) {
return (Logger) cns.newInstance(loggerName,
null);
@@ -276,7 +277,7 @@ public final class LogUtils {
}
} else {
try {
- return (Logger) cns.newInstance(loggerName,
BundleUtils.getBundleName(cls, name));
+ return (Logger) cns.newInstance(loggerName,
bundleName);
} catch (InvocationTargetException ite) {
if (ite.getTargetException() instanceof
MissingResourceException) {
throw
(MissingResourceException)ite.getTargetException();
@@ -291,7 +292,7 @@ public final class LogUtils {
}
try {
- logger = Logger.getLogger(loggerName, name); //NOPMD
+ logger = Logger.getLogger(loggerName, bundleName); //NOPMD
} catch (IllegalArgumentException iae) {
//likely a mismatch on the bundle name, just return the default
logger = Logger.getLogger(loggerName); //NOPMD