Skip to content

chore: log4j 2.20.0 #1859

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

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions caffeine-bounded-cache-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<artifactId>log4j-slf4j2-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
3 changes: 1 addition & 2 deletions operator-framework-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,13 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<artifactId>log4j-slf4j2-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

Expand Down
3 changes: 1 addition & 2 deletions operator-framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,13 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<artifactId>log4j-slf4j2-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package io.javaoperatorsdk.operator.config.runtime;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.AppenderRef;
import org.apache.logging.log4j.core.config.LoggerConfig;
import org.apache.logging.log4j.core.layout.PatternLayout;
import org.apache.logging.log4j.test.appender.ListAppender;
import org.junit.jupiter.api.Test;

import io.fabric8.kubernetes.client.CustomResource;
Expand All @@ -17,60 +11,13 @@
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.*;

class DefaultConfigurationServiceTest {

public static final String CUSTOM_FINALIZER_NAME = "a.custom/finalizer";
final DefaultConfigurationService configurationService = DefaultConfigurationService.instance();

@Test
void attemptingToRetrieveAnUnknownControllerShouldLogWarning() {
final LoggerContext context = LoggerContext.getContext(false);
final PatternLayout layout = PatternLayout.createDefaultLayout(context.getConfiguration());
final ListAppender appender = new ListAppender("list", null, layout, false, false);

appender.start();

context.getConfiguration().addAppender(appender);

AppenderRef ref = AppenderRef.createAppenderRef("list", null, null);
final var loggerName = configurationService.getLoggerName();
LoggerConfig loggerConfig =
LoggerConfig.createLogger(
false,
Level.valueOf("info"),
loggerName,
"false",
new AppenderRef[] {ref},
null,
context.getConfiguration(),
null);
loggerConfig.addAppender(appender, null, null);

context.getConfiguration().addLogger(loggerName, loggerConfig);
context.updateLoggers();

try {
final var config =
configurationService
.getConfigurationFor(new NotAutomaticallyCreated(), false);

assertThat(config).isNull();
assertThat(appender.getMessages())
.hasSize(1)
.allMatch(m -> m.contains(NotAutomaticallyCreated.NAME) && m.contains("not found"));
} finally {
appender.stop();

context.getConfiguration().removeLogger(loggerName);
context.updateLoggers();
}
}

@Test
void returnsValuesFromControllerAnnotationFinalizer() {
final var reconciler = new TestCustomReconciler();
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<junit.version>5.9.1</junit.version>
<fabric8-client.version>6.5.1</fabric8-client.version>
<slf4j.version>1.7.36</slf4j.version>
<log4j.version>2.19.0</log4j.version>
<log4j.version>2.20.0</log4j.version>
<mokito.version>5.3.0</mokito.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<compile-testing.version>0.19</compile-testing.version>
Expand Down Expand Up @@ -159,12 +159,12 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<artifactId>log4j2-core</artifactId>
<version>${log4j.version}</version>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion sample-operators/leader-election/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<artifactId>log4j-slf4j2-impl</artifactId>
</dependency>
<dependency>
<groupId>org.takes</groupId>
Expand Down
2 changes: 1 addition & 1 deletion sample-operators/mysql-schema/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<artifactId>log4j-slf4j2-impl</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
2 changes: 1 addition & 1 deletion sample-operators/tomcat-operator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<artifactId>log4j-slf4j2-impl</artifactId>
</dependency>
<dependency>
<groupId>org.takes</groupId>
Expand Down
2 changes: 1 addition & 1 deletion sample-operators/webpage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<artifactId>log4j-slf4j2-impl</artifactId>
</dependency>
<dependency>
<groupId>org.takes</groupId>
Expand Down