Skip to content

Commit

Permalink
Improves logging messages
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1330502 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
lukaszlenart committed Apr 25, 2012
1 parent 495753e commit 37ebc85
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,20 +316,20 @@ void alias(Class type, String key, ContainerBuilder builder, Properties props, S
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
Expand All @@ -344,7 +344,7 @@ void alias(Class type, String key, ContainerBuilder builder, Properties props, S
}
} 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());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void cleanupRequest(HttpServletRequest request) {
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public String intercept(ActionInvocation ai) throws Exception {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public Validator buildValidator(String className, Map<String, String> params, Ma
*/
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);
}
Expand All @@ -279,7 +279,7 @@ public TypeConverter buildConverter(Class<? extends TypeConverter> converterClas
*/
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);
}
Expand All @@ -292,11 +292,11 @@ public TypeConverter buildConverter(Class<? extends TypeConverter> converterClas
*/
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 37ebc85

Please sign in to comment.