Skip to content

Commit

Permalink
Handle this deprecation differently.
Browse files Browse the repository at this point in the history
headius committed Mar 27, 2018

Verified

This commit was signed with the committer’s verified signature.
headius Charles Oliver Nutter
1 parent 2a265b1 commit 1718c4a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/src/test/java/org/jruby/util/log/LoggerFactoryTest.java
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@ public void usesStandardErrorLoggerByDefault() {
}

@Test
@SuppressWarnings("deprecation")
public void usingJULLogger() throws Exception {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger("JULLogger");
@@ -95,7 +96,7 @@ public synchronized String format(java.util.logging.LogRecord record) {

changeLoggerImpl(JULLogger.class);

Logger logger = LoggerFactory.getLogger(LoggerFactoryTest.class);
Logger logger = LoggerFactory.getLogger("JULLogger");
assertFalse( logger.isDebugEnabled() );

logger.debug("ignored debug stuff");
@@ -107,11 +108,11 @@ public synchronized String format(java.util.logging.LogRecord record) {

logger.info("logged at info level");
handler.flush();
assertEquals(log += "LoggerFactoryTest INFO: logged at info level\n", out.toString());
assertEquals(log += "JULLogger INFO: logged at info level\n", out.toString());

logger.warn("logged at {} {}", "warn", new StringBuilder("level"));
handler.flush();
assertEquals(log += "LoggerFactoryTest WARNING: logged at warn level\n", out.toString());
assertEquals(log += "JULLogger WARNING: logged at warn level\n", out.toString());

julLogger.setLevel(java.util.logging.Level.WARNING);

@@ -122,7 +123,7 @@ public synchronized String format(java.util.logging.LogRecord record) {

logger.error("bad news", new RuntimeException("exception happened"));
handler.flush();
assertStartsWith(log += "LoggerFactoryTest SEVERE: bad news\njava.lang.RuntimeException: exception happened", out.toString());
assertStartsWith(log += "JULLogger SEVERE: bad news\njava.lang.RuntimeException: exception happened", out.toString());
}

@Test

0 comments on commit 1718c4a

Please sign in to comment.