You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ppkarwasz (via GitHub)" <gi...@apache.org> on 2024/02/15 13:30:08 UTC
Re: [PR] Fix 1799 and Spring 33450 (logging-log4j2)
ppkarwasz commented on code in PR #2062:
URL: https://github.com/apache/logging-log4j2/pull/2062#discussion_r1491011916
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/impl/internal/InternalLoggerContext.java:
##########
@@ -0,0 +1,290 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.core.impl.internal;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogBuilder;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.Logger;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.LoggerConfig;
+import org.apache.logging.log4j.message.Message;
+import org.apache.logging.log4j.message.MessageFactory;
+import org.apache.logging.log4j.simple.SimpleLoggerContext;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+
+/**
+ * Creates a SimpleLoggerContext compatible with log4j-core. This class is internal to Log4j.
Review Comment:
[For future reference, the caller is [this code](https://github.com/spring-projects/spring-boot/blob/224254b3003e4af4344dbc76afd4d9bac877b9a5/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java#L480-L482) in Spring Boot
```java
private LoggerContext getLoggerContext() {
return (LoggerContext) LogManager.getContext(false);
}
```
]
@rgoers: looking at this again, I don't think it is a good idea to add a new public method to `LoggerContextFactory` and an entire dummy class, just because Spring Boot did an unchecked cast.
Do you mind if I remove this class and fix the Spring Boot code instead?
--
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: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org