kusalk commented on code in PR #986:
URL: https://github.com/apache/struts/pull/986#discussion_r1677121558
##########
plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java:
##########
@@ -98,16 +104,17 @@ public PropertyDescriptor[] getProperties() {
return properties;
}
+ @Override
public String execute() throws Exception {
super.execute();
config = configHelper.getActionConfig(namespace, actionName);
- actionNames = new
TreeSet<String>(configHelper.getActionNames(namespace));
+ actionNames = new TreeSet<>(configHelper.getActionNames(namespace));
try {
Object action = objectFactory.buildAction(actionName, namespace,
config, null);
properties = reflectionProvider.getPropertyDescriptors(action);
} catch (Exception e) {
- LOG.error("Unable to get properties for action " + actionName, e);
- addActionError("Unable to retrieve action properties: " +
e.toString());
+ LOG.error("Unable to get properties for action {}", actionName, e);
Review Comment:
So I double checked this because IntelliJ insisted this was correct despite
the JavaDoc for the method suggesting it was incorrect. Turns out Log4J 2 will
actually log this correctly as it will identify that the last argument is an
exception (also tested locally). Here is the relevant Log4J 2 code -
https://github.com/apache/logging-log4j2/blob/rel/2.23.1/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableParameterizedMessage.java#L128
And the relevant documentation -
https://logging.apache.org/log4j/2.x/manual/api.html#substituting-parameters
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]