Skip to content

Commit

Permalink
Fix duplicate logging when converting logback to Java (#235)
Browse files Browse the repository at this point in the history
* Fix duplicate logging when converting logback to Java

This commit fixes the logback to Java converter. While conversion
worked, it was actually duplicating logs because the return value
of the configurator was wrong and that it triggered the creation
of additional configuration from logback.

* Fix tests
  • Loading branch information
melix authored Sep 1, 2023
1 parent a0be826 commit 065112c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public void postVisitConfiguration(ConfigurationModel model, Model parent) {
}
};
visitor.visit(model);
codeBuilder.addStatement(CodeBlock.of("return $T.NEUTRAL", Configurator.ExecutionStatus.class));
codeBuilder.addStatement(CodeBlock.of("return $T.DO_NOT_INVOKE_NEXT_IF_ANY", Configurator.ExecutionStatus.class));
return MethodSpec.methodBuilder("configure")
.addModifiers(Modifier.PUBLIC)
.returns(Configurator.ExecutionStatus.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class StaticLogbackConfiguration implements Configurator {
io_micronaut_core_optim_staticoptimizations.addAppender(stdout);
io_micronaut_core_io_service_softserviceloader.addAppender(stdout);
io_micronaut_aot.addAppender(stdout);
return Configurator.ExecutionStatus.NEUTRAL;
return Configurator.ExecutionStatus.DO_NOT_INVOKE_NEXT_IF_ANY;
}
public void setContext(Context context) {
Expand Down Expand Up @@ -169,7 +169,7 @@ public class StaticLogbackConfiguration implements Configurator {
_rootLogger.setLevel(Level.INFO);
_rootLogger.addAppender(file);
org_acme.addAppender(console);
return Configurator.ExecutionStatus.NEUTRAL;
return Configurator.ExecutionStatus.DO_NOT_INVOKE_NEXT_IF_ANY;
}
public void setContext(Context context) {
Expand Down Expand Up @@ -262,7 +262,7 @@ public class StaticLogbackConfiguration implements Configurator {
Logger _rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
_rootLogger.setLevel(Level.INFO);
_rootLogger.addAppender(file);
return Configurator.ExecutionStatus.NEUTRAL;
return Configurator.ExecutionStatus.DO_NOT_INVOKE_NEXT_IF_ANY;
}
public void setContext(Context context) {
Expand Down Expand Up @@ -348,7 +348,7 @@ public class StaticLogbackConfiguration implements Configurator {
Logger _rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
_rootLogger.setLevel(Level.INFO);
_rootLogger.addAppender(console);
return Configurator.ExecutionStatus.NEUTRAL;
return Configurator.ExecutionStatus.DO_NOT_INVOKE_NEXT_IF_ANY;
}
public void setContext(Context context) {
Expand Down

0 comments on commit 065112c

Please sign in to comment.