Skip to content

Commit

Permalink
Use parameterized logging everywhere
Browse files Browse the repository at this point in the history
Our code should be an example to users: we should never use string
concatenation in log messages.

This was performed using OpenRewrite and is related to #1706.
  • Loading branch information
ppkarwasz committed Nov 20, 2023
1 parent 12f4755 commit 734e548
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected ResourceBundle getResourceBundle(
}
} catch (final MissingResourceException ex) {
if (!loop) {
logger.debug("Unable to locate ResourceBundle " + rbBaseName);
logger.debug("Unable to locate ResourceBundle {}", rbBaseName);
return null;
}
}
Expand All @@ -247,7 +247,7 @@ protected ResourceBundle getResourceBundle(
rb = ResourceBundle.getBundle(substr);
}
} catch (final MissingResourceException ex) {
logger.debug("Unable to locate ResourceBundle " + substr);
logger.debug("Unable to locate ResourceBundle {}", substr);
}
}
return rb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected String formatMessage(final String msgPattern, final Object... args) {
final MessageFormat temp = new MessageFormat(msgPattern, locale);
return temp.format(args);
} catch (final IllegalFormatException ife) {
LOGGER.error("Unable to format msg: " + msgPattern, ife);
LOGGER.error("Unable to format msg: {}", msgPattern, ife);
return msgPattern;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected String formatMessage(final String msgPattern, final Object... args) {
try {
return String.format(locale, msgPattern, args);
} catch (final IllegalFormatException ife) {
LOGGER.error("Unable to format msg: " + msgPattern, ife);
LOGGER.error("Unable to format msg: {}", msgPattern, ife);
return msgPattern;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void error(final String message) {

@Override
public void error(final Throwable throwable) {
logger.error(throwable);
logger.error("", throwable);
}

@Override
Expand Down

0 comments on commit 734e548

Please sign in to comment.