Improves logging messages

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1330502 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Lukasz Lenart
2012-04-25 19:25:03 +00:00
parent 495753e1aa
commit 37ebc858a3
5 changed files with 12 additions and 12 deletions
@@ -316,20 +316,20 @@ public class BeanSelectionProvider implements ConfigurationProvider {
String foundName = props.getProperty(key, DEFAULT_BEAN_NAME);
if (builder.contains(type, foundName)) {
if (LOG.isInfoEnabled()) {
LOG.info("Choosing bean (#1) for (#2)", foundName, type.getName());
LOG.info("Choosing bean (#0) for (#1)", foundName, type.getName());
}
builder.alias(type, foundName, Container.DEFAULT_NAME);
} else {
try {
Class cls = ClassLoaderUtil.loadClass(foundName, this.getClass());
if (LOG.isDebugEnabled()) {
LOG.debug("Choosing bean (#1) for (#2)", cls.getName(), type.getName());
LOG.debug("Choosing bean (#0) for (#1)", cls.getName(), type.getName());
}
builder.factory(type, cls, scope);
} catch (ClassNotFoundException ex) {
// Perhaps a spring bean id, so we'll delegate to the object factory at runtime
if (LOG.isDebugEnabled()) {
LOG.debug("Choosing bean (#1) for (#2) to be loaded from the ObjectFactory", foundName, type.getName());
LOG.debug("Choosing bean (#0) for (#1) to be loaded from the ObjectFactory", foundName, type.getName());
}
if (DEFAULT_BEAN_NAME.equals(foundName)) {
// Probably an optional bean, will ignore
@@ -344,7 +344,7 @@ public class BeanSelectionProvider implements ConfigurationProvider {
}
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Unable to alias bean type (#1), default mapping already assigned.", type.getName());
LOG.warn("Unable to alias bean type (#0), default mapping already assigned.", type.getName());
}
}
}
@@ -104,7 +104,7 @@ public class PrepareOperations {
dispatcher.cleanUpRequest(request);
} catch (IOException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Cannot clean up the request, some files can still remain in #1 after upload!", e,
LOG.warn("Cannot clean up the request, some files can still remain in #0 after upload!", e,
StrutsConstants.STRUTS_MULTIPART_SAVEDIR);
}
} finally {
@@ -72,7 +72,7 @@ public class CheckboxInterceptor extends AbstractInterceptor {
iterator.remove();
if (values != null && values instanceof String[] && ((String[])values).length > 1) {
if (LOG.isDebugEnabled()) {
LOG.debug("Bypassing automatic checkbox detection due to multiple checkboxes of the same name: #1", name);
LOG.debug("Bypassing automatic checkbox detection due to multiple checkboxes of the same name: #0", name);
}
continue;
}
@@ -265,7 +265,7 @@ public class ObjectFactory implements Serializable {
*/
public TypeConverter buildConverter(Class<? extends TypeConverter> converterClass) {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating converter of type [#1]", converterClass.getCanonicalName());
LOG.debug("Creating converter of type [#0]", converterClass.getCanonicalName());
}
return container.getInstance(converterClass);
}
@@ -279,7 +279,7 @@ public class ObjectFactory implements Serializable {
*/
public TypeConverter buildConverter(Class<? extends TypeConverter> converterClass, String name) {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating converter of type [#1] with name [#2]", converterClass.getCanonicalName(), name);
LOG.debug("Creating converter of type [#0] with name [#1]", converterClass.getCanonicalName(), name);
}
return container.getInstance(converterClass, name);
}
@@ -292,11 +292,11 @@ public class ObjectFactory implements Serializable {
*/
public TypeConverter buildConverter(String name) {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating converter with name [#1]", name);
LOG.debug("Creating converter with name [#0]", name);
}
TypeConverter instance = container.getInstance(TypeConverter.class, name);
if (LOG.isDebugEnabled()) {
LOG.debug("Converter of Type [#1] with name [#2], created!", instance.getClass().getCanonicalName(), name);
LOG.debug("Converter of Type [#0] with name [#1], created!", instance.getClass().getCanonicalName(), name);
}
return instance;
}
@@ -24,12 +24,12 @@ public class LoggerUtils {
* Formats messages using parameters. For example, the call:
*
* <pre>
* format("foo #1", "bob");
* format("foo #0 #1", "bob", "joe");
* </pre>
*
* will return:
* <pre>
* foo bob
* foo bob joe
* </pre>
*
* @param msg The message