Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide actionable warning when logging level is lower than min level #30742

Merged
merged 1 commit into from
Jan 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ public ShutdownListener initializeLogging(LogConfig config, LogBuildTimeConfig b
final Logger rootLogger = logContext.getLogger("");

if (config.level.intValue() < buildConfig.minLevel.intValue()) {
log.warnf("Root log level %s set below minimum logging level %s, promoting it to %s",
config.level, buildConfig.minLevel, buildConfig.minLevel);
log.warnf(
"Root log level %s set below minimum logging level %s, promoting it to %s. Set the build time configuration property 'quarkus.log.min-level' to '%s' to avoid this warning",
geoand marked this conversation as resolved.
Show resolved Hide resolved
config.level, buildConfig.minLevel, buildConfig.minLevel, config.level);

rootLogger.setLevel(buildConfig.minLevel);
} else {
Expand Down Expand Up @@ -222,9 +223,10 @@ public void accept(String categoryName, CategoryConfig config) {
CategoryBuildTimeConfig::getMinLevel, categoryDefaultMinLevels, buildConfig.minLevel);

if (logLevel.intValue() < minLogLevel.intValue()) {
log.warnf("Log level %s for category '%s' set below minimum logging level %s, promoting it to %s",
log.warnf(
"Log level %s for category '%s' set below minimum logging level %s, promoting it to %s. Set the build time configuration property 'quarkus.log.category.\"%s\".level' to '%s' to avoid this warning",
logLevel,
categoryName, minLogLevel, minLogLevel);
categoryName, minLogLevel, minLogLevel, categoryName, logLevel);

config.level = InheritableLevel.of(minLogLevel.toString());
}
Expand Down Expand Up @@ -315,8 +317,12 @@ public static void initializeBuildTimeLogging(LogConfig config, LogBuildTimeConf
categoryDefaultMinLevels, buildConfig.minLevel);

if (logLevel.intValue() < minLogLevel.intValue()) {
log.warnf("Log level %s for category '%s' set below minimum logging level %s, promoting it to %s", logLevel,
entry.getKey(), minLogLevel, minLogLevel);
String category = entry.getKey();
log.warnf("Log level %s for category '%s' set below minimum logging level %s, promoting it to %s. "
+
"Set the build time configuration property 'quarkus.log.category.\"%s\".level' to '%s' to avoid this warning",
logLevel,
category, minLogLevel, minLogLevel, category, logLevel);

entry.getValue().level = InheritableLevel.of(minLogLevel.toString());
}
Expand Down