Fix various usages of the Flogger API

- Don't use String.format; instead pass the string directly and let
  Flogger do the formatting. This means the formatting is only done
  when thte log level is enabled.

- Pass exception via withCause rather than as an unreferenced vararg.

- When explicitly passing an exception as vararg with the intention of
  not logging a stack trace, call getMessage() instead of just passing
  the exception object.

Change-Id: Icfe0712b5ebd1d05c630363853a311d734674d14
This commit is contained in:
David Pursehouse
2020-04-27 08:49:26 +09:00
parent c91487abbd
commit ec43a2f070
4 changed files with 8 additions and 9 deletions

View File

@@ -230,7 +230,8 @@ public class PluginConfigFactory implements ReloadPluginListener {
cfg.load();
} catch (ConfigInvalidException e) {
// This is an error in user input, don't spam logs with a stack trace.
logger.atWarning().log("Failed to load %s: %s", pluginConfigFile.toAbsolutePath(), e);
logger.atWarning().log(
"Failed to load %s: %s", pluginConfigFile.toAbsolutePath(), e.getMessage());
} catch (IOException e) {
logger.atWarning().withCause(e).log("Failed to load %s", pluginConfigFile.toAbsolutePath());
}