azagrebin commented on a change in pull request #11073: [FLINK-15672][build] 
Migrate to log4j2 
URL: https://github.com/apache/flink/pull/11073#discussion_r381157957
 
 

 ##########
 File path: 
flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/testutils/logging/TestLoggerResource.java
 ##########
 @@ -0,0 +1,104 @@
+/*
+ * 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.flink.testutils.logging;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+import org.apache.logging.log4j.core.config.AppenderRef;
+import org.apache.logging.log4j.core.config.LoggerConfig;
+import org.junit.rules.ExternalResource;
+
+import javax.annotation.concurrent.GuardedBy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Utility for auditing logged messages.
+ *
+ * <p>When using this class, keep
+ *
+ * <p>Implementation note: Make sure to not expose log4j dependencies in the 
interface of this class to ease updates
+ * in logging infrastructure.
+ */
+public class TestLoggerResource extends ExternalResource {
+       private static final LoggerContext LOGGER_CONTEXT = (LoggerContext) 
LogManager.getContext(false);
+
+       private final String loggerName;
+       private final org.slf4j.event.Level level;
+
+       private final Object lock = new Object();
+
+       @GuardedBy("lock")
+       private List<String> loggingEvents;
+
+       public TestLoggerResource(Class<?> clazz, org.slf4j.event.Level level) {
 
 Review comment:
   any particular reason to use `org.slf4j.event.Level` here instead of 
`org.apache.logging.log4j.Level`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to