rgoers commented on code in PR #2062:
URL: https://github.com/apache/logging-log4j2/pull/2062#discussion_r1449323508
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java:
##########
@@ -146,8 +149,12 @@ public LoggerContext getContext(
if (externalContext != null && ctx.getExternalContext() == null) {
ctx.setExternalContext(externalContext);
}
- if (ctx.getState() == LifeCycle.State.INITIALIZED) {
- startContext(ctx, classLoader);
+ try {
+ if (ctx.getState() == LifeCycle.State.INITIALIZED) {
+ startContext(ctx, classLoader);
+ }
+ } catch (IllegalStateException ex) {
+ return internalContext;
Review Comment:
Previously the error was propagated back to LogManager. It would log a Warn
message and then promptly get a ClassCastException as it returned the
LoggerContext from logj-api, not a LoggerContext compatible with log4j-core. I
think I might have a better way to deal with this so I will look into it.
--
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]