|
13 | 13 | */
|
14 | 14 | package ch.qos.logback.classic.joran;
|
15 | 15 |
|
16 |
| -import ch.qos.logback.classic.AsyncAppender; |
17 |
| -import ch.qos.logback.classic.ClassicConstants; |
18 |
| -import ch.qos.logback.classic.ClassicTestConstants; |
19 |
| -import ch.qos.logback.classic.Level; |
20 |
| -import ch.qos.logback.classic.Logger; |
21 |
| -import ch.qos.logback.classic.LoggerContext; |
| 16 | +import ch.qos.logback.classic.*; |
22 | 17 | import ch.qos.logback.classic.joran.serializedModel.HardenedModelInputStream;
|
23 |
| -import ch.qos.logback.classic.jul.JULHelper; |
24 | 18 | import ch.qos.logback.classic.model.ConfigurationModel;
|
25 | 19 | import ch.qos.logback.classic.model.LoggerModel;
|
26 | 20 | import ch.qos.logback.classic.spi.ILoggingEvent;
|
|
42 | 36 | import ch.qos.logback.core.spi.ScanException;
|
43 | 37 | import ch.qos.logback.core.status.Status;
|
44 | 38 | import ch.qos.logback.core.status.testUtil.StatusChecker;
|
45 |
| -import ch.qos.logback.core.testUtil.CoreTestConstants; |
46 | 39 | import ch.qos.logback.core.testUtil.RandomUtil;
|
47 | 40 | import ch.qos.logback.core.testUtil.StringListAppender;
|
48 | 41 | import ch.qos.logback.core.util.CachingDateFormatter;
|
|
56 | 49 | import org.slf4j.spi.MDCAdapter;
|
57 | 50 |
|
58 | 51 | import java.io.FileInputStream;
|
59 |
| -import java.io.FileNotFoundException; |
60 | 52 | import java.io.IOException;
|
61 | 53 | import java.text.SimpleDateFormat;
|
62 | 54 | import java.util.Date;
|
|
66 | 58 | import static ch.qos.logback.core.model.processor.ImplicitModelHandler.IGNORING_UNKNOWN_PROP;
|
67 | 59 | import static ch.qos.logback.core.model.processor.ShutdownHookModelHandler.RENAME_WARNING;
|
68 | 60 | import static ch.qos.logback.core.testUtil.CoreTestConstants.OUTPUT_DIR_PREFIX;
|
69 |
| -import static org.junit.jupiter.api.Assertions.assertEquals; |
70 |
| -import static org.junit.jupiter.api.Assertions.assertFalse; |
71 |
| -import static org.junit.jupiter.api.Assertions.assertNotNull; |
72 |
| -import static org.junit.jupiter.api.Assertions.assertNull; |
73 |
| -import static org.junit.jupiter.api.Assertions.assertTrue; |
| 61 | +import static org.junit.jupiter.api.Assertions.*; |
74 | 62 |
|
75 | 63 | public class JoranConfiguratorTest {
|
76 | 64 |
|
@@ -394,45 +382,7 @@ public void encoderCharset() throws JoranException, IOException, InterruptedExce
|
394 | 382 | checker.assertIsErrorFree();
|
395 | 383 | }
|
396 | 384 |
|
397 |
| - void verifyJULLevel(String loggerName, Level expectedLevel) { |
398 |
| - java.util.logging.Logger julLogger = JULHelper.asJULLogger(loggerName); |
399 |
| - java.util.logging.Level julLevel = julLogger.getLevel(); |
400 | 385 |
|
401 |
| - if (expectedLevel == null) { |
402 |
| - assertNull(julLevel); |
403 |
| - } else { |
404 |
| - assertEquals(JULHelper.asJULLevel(expectedLevel), julLevel); |
405 |
| - } |
406 |
| - |
407 |
| - } |
408 |
| - |
409 |
| - @Test |
410 |
| - public void levelChangePropagator0() throws JoranException, IOException, InterruptedException { |
411 |
| - String loggerName = "changePropagator0" + diff; |
412 |
| - java.util.logging.Logger.getLogger(loggerName).setLevel(java.util.logging.Level.INFO); |
413 |
| - String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "/jul/levelChangePropagator0.xml"; |
414 |
| - configure(configFileAsStr); |
415 |
| - |
416 |
| - checker.assertIsErrorFree(); |
417 |
| - verifyJULLevel(loggerName, null); |
418 |
| - verifyJULLevel("a.b.c." + diff, Level.WARN); |
419 |
| - verifyJULLevel(Logger.ROOT_LOGGER_NAME, Level.TRACE); |
420 |
| - } |
421 |
| - |
422 |
| - @Test |
423 |
| - public void levelChangePropagator1() throws JoranException, IOException, InterruptedException { |
424 |
| - String loggerName = "changePropagator1" + diff; |
425 |
| - java.util.logging.Logger logger1 = java.util.logging.Logger.getLogger(loggerName); |
426 |
| - logger1.setLevel(java.util.logging.Level.INFO); |
427 |
| - verifyJULLevel(loggerName, Level.INFO); |
428 |
| - String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "/jul/levelChangePropagator1.xml"; |
429 |
| - configure(configFileAsStr); |
430 |
| - |
431 |
| - checker.assertIsErrorFree(); |
432 |
| - verifyJULLevel(loggerName, Level.INFO); // |
433 |
| - verifyJULLevel("a.b.c." + diff, Level.WARN); |
434 |
| - verifyJULLevel(Logger.ROOT_LOGGER_NAME, Level.TRACE); |
435 |
| - } |
436 | 386 |
|
437 | 387 | @Disabled // because slow
|
438 | 388 | @Test
|
|
0 commit comments