Java Code Examples for java.util.logging.Logger#getResourceBundleName()
The following examples show how to use
java.util.logging.Logger#getResourceBundleName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestSetResourceBundle.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) { final String logName = logger.getName(); final String prefix = " " + logName; System.err.println("Logger " + logName + " logged with bundle name " + handler.lastBundleName + " (" + handler.lastBundle + ")"); System.err.println(prefix + ".getResourceBundleName() is " + logger.getResourceBundleName()); System.err.println(prefix + ".getResourceBundle() is " + logger.getResourceBundle()); final Logger parent = logger.getParent(); final String pname = parent == null ? null : parent.getName(); final String pclass = parent == null ? "" : ("(" + parent.getClass().getName() + ")"); final String presn = parent == null ? null : parent.getResourceBundleName(); final ResourceBundle pres = parent == null ? null : parent.getResourceBundle(); System.err.println(prefix + ".getParent() is " + pname + (pname == null ? "" : (" " + pclass + ": " + parent))); System.err.println(" expected parent is :" + expectedParent); System.err.println(prefix + ".parent.getResourceBundleName() is " + presn); System.err.println(prefix + ".parent.getResourceBundle() is " + pres); System.err.println(" expected parent getResourceBundleName() is " + expectedParent.getResourceBundleName()); System.err.println(" expected parent.getResourceBundle() is " + expectedParent.getResourceBundle()); }
Example 2
Source File: TestSetResourceBundle.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) { final String logName = logger.getName(); final String prefix = " " + logName; System.err.println("Logger " + logName + " logged with bundle name " + handler.lastBundleName + " (" + handler.lastBundle + ")"); System.err.println(prefix + ".getResourceBundleName() is " + logger.getResourceBundleName()); System.err.println(prefix + ".getResourceBundle() is " + logger.getResourceBundle()); final Logger parent = logger.getParent(); final String pname = parent == null ? null : parent.getName(); final String pclass = parent == null ? "" : ("(" + parent.getClass().getName() + ")"); final String presn = parent == null ? null : parent.getResourceBundleName(); final ResourceBundle pres = parent == null ? null : parent.getResourceBundle(); System.err.println(prefix + ".getParent() is " + pname + (pname == null ? "" : (" " + pclass + ": " + parent))); System.err.println(" expected parent is :" + expectedParent); System.err.println(prefix + ".parent.getResourceBundleName() is " + presn); System.err.println(prefix + ".parent.getResourceBundle() is " + pres); System.err.println(" expected parent getResourceBundleName() is " + expectedParent.getResourceBundleName()); System.err.println(" expected parent.getResourceBundle() is " + expectedParent.getResourceBundle()); }
Example 3
Source File: TestSetResourceBundle.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) { final String logName = logger.getName(); final String prefix = " " + logName; System.err.println("Logger " + logName + " logged with bundle name " + handler.lastBundleName + " (" + handler.lastBundle + ")"); System.err.println(prefix + ".getResourceBundleName() is " + logger.getResourceBundleName()); System.err.println(prefix + ".getResourceBundle() is " + logger.getResourceBundle()); final Logger parent = logger.getParent(); final String pname = parent == null ? null : parent.getName(); final String pclass = parent == null ? "" : ("(" + parent.getClass().getName() + ")"); final String presn = parent == null ? null : parent.getResourceBundleName(); final ResourceBundle pres = parent == null ? null : parent.getResourceBundle(); System.err.println(prefix + ".getParent() is " + pname + (pname == null ? "" : (" " + pclass + ": " + parent))); System.err.println(" expected parent is :" + expectedParent); System.err.println(prefix + ".parent.getResourceBundleName() is " + presn); System.err.println(prefix + ".parent.getResourceBundle() is " + pres); System.err.println(" expected parent getResourceBundleName() is " + expectedParent.getResourceBundleName()); System.err.println(" expected parent.getResourceBundle() is " + expectedParent.getResourceBundle()); }
Example 4
Source File: TestSetResourceBundle.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) { final String logName = logger.getName(); final String prefix = " " + logName; System.err.println("Logger " + logName + " logged with bundle name " + handler.lastBundleName + " (" + handler.lastBundle + ")"); System.err.println(prefix + ".getResourceBundleName() is " + logger.getResourceBundleName()); System.err.println(prefix + ".getResourceBundle() is " + logger.getResourceBundle()); final Logger parent = logger.getParent(); final String pname = parent == null ? null : parent.getName(); final String pclass = parent == null ? "" : ("(" + parent.getClass().getName() + ")"); final String presn = parent == null ? null : parent.getResourceBundleName(); final ResourceBundle pres = parent == null ? null : parent.getResourceBundle(); System.err.println(prefix + ".getParent() is " + pname + (pname == null ? "" : (" " + pclass + ": " + parent))); System.err.println(" expected parent is :" + expectedParent); System.err.println(prefix + ".parent.getResourceBundleName() is " + presn); System.err.println(prefix + ".parent.getResourceBundle() is " + pres); System.err.println(" expected parent getResourceBundleName() is " + expectedParent.getResourceBundleName()); System.err.println(" expected parent.getResourceBundle() is " + expectedParent.getResourceBundle()); }
Example 5
Source File: TestSetResourceBundle.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) { final String logName = logger.getName(); final String prefix = " " + logName; System.err.println("Logger " + logName + " logged with bundle name " + handler.lastBundleName + " (" + handler.lastBundle + ")"); System.err.println(prefix + ".getResourceBundleName() is " + logger.getResourceBundleName()); System.err.println(prefix + ".getResourceBundle() is " + logger.getResourceBundle()); final Logger parent = logger.getParent(); final String pname = parent == null ? null : parent.getName(); final String pclass = parent == null ? "" : ("(" + parent.getClass().getName() + ")"); final String presn = parent == null ? null : parent.getResourceBundleName(); final ResourceBundle pres = parent == null ? null : parent.getResourceBundle(); System.err.println(prefix + ".getParent() is " + pname + (pname == null ? "" : (" " + pclass + ": " + parent))); System.err.println(" expected parent is :" + expectedParent); System.err.println(prefix + ".parent.getResourceBundleName() is " + presn); System.err.println(prefix + ".parent.getResourceBundle() is " + pres); System.err.println(" expected parent getResourceBundleName() is " + expectedParent.getResourceBundleName()); System.err.println(" expected parent.getResourceBundle() is " + expectedParent.getResourceBundle()); }
Example 6
Source File: TestSetResourceBundle.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) { final String logName = logger.getName(); final String prefix = " " + logName; System.err.println("Logger " + logName + " logged with bundle name " + handler.lastBundleName + " (" + handler.lastBundle + ")"); System.err.println(prefix + ".getResourceBundleName() is " + logger.getResourceBundleName()); System.err.println(prefix + ".getResourceBundle() is " + logger.getResourceBundle()); final Logger parent = logger.getParent(); final String pname = parent == null ? null : parent.getName(); final String pclass = parent == null ? "" : ("(" + parent.getClass().getName() + ")"); final String presn = parent == null ? null : parent.getResourceBundleName(); final ResourceBundle pres = parent == null ? null : parent.getResourceBundle(); System.err.println(prefix + ".getParent() is " + pname + (pname == null ? "" : (" " + pclass + ": " + parent))); System.err.println(" expected parent is :" + expectedParent); System.err.println(prefix + ".parent.getResourceBundleName() is " + presn); System.err.println(prefix + ".parent.getResourceBundle() is " + pres); System.err.println(" expected parent getResourceBundleName() is " + expectedParent.getResourceBundleName()); System.err.println(" expected parent.getResourceBundle() is " + expectedParent.getResourceBundle()); }
Example 7
Source File: TestSetResourceBundle.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) { final String logName = logger.getName(); final String prefix = " " + logName; System.err.println("Logger " + logName + " logged with bundle name " + handler.lastBundleName + " (" + handler.lastBundle + ")"); System.err.println(prefix + ".getResourceBundleName() is " + logger.getResourceBundleName()); System.err.println(prefix + ".getResourceBundle() is " + logger.getResourceBundle()); final Logger parent = logger.getParent(); final String pname = parent == null ? null : parent.getName(); final String pclass = parent == null ? "" : ("(" + parent.getClass().getName() + ")"); final String presn = parent == null ? null : parent.getResourceBundleName(); final ResourceBundle pres = parent == null ? null : parent.getResourceBundle(); System.err.println(prefix + ".getParent() is " + pname + (pname == null ? "" : (" " + pclass + ": " + parent))); System.err.println(" expected parent is :" + expectedParent); System.err.println(prefix + ".parent.getResourceBundleName() is " + presn); System.err.println(prefix + ".parent.getResourceBundle() is " + pres); System.err.println(" expected parent getResourceBundleName() is " + expectedParent.getResourceBundleName()); System.err.println(" expected parent.getResourceBundle() is " + expectedParent.getResourceBundle()); }
Example 8
Source File: TestSetResourceBundle.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) { final String logName = logger.getName(); final String prefix = " " + logName; System.err.println("Logger " + logName + " logged with bundle name " + handler.lastBundleName + " (" + handler.lastBundle + ")"); System.err.println(prefix + ".getResourceBundleName() is " + logger.getResourceBundleName()); System.err.println(prefix + ".getResourceBundle() is " + logger.getResourceBundle()); final Logger parent = logger.getParent(); final String pname = parent == null ? null : parent.getName(); final String pclass = parent == null ? "" : ("(" + parent.getClass().getName() + ")"); final String presn = parent == null ? null : parent.getResourceBundleName(); final ResourceBundle pres = parent == null ? null : parent.getResourceBundle(); System.err.println(prefix + ".getParent() is " + pname + (pname == null ? "" : (" " + pclass + ": " + parent))); System.err.println(" expected parent is :" + expectedParent); System.err.println(prefix + ".parent.getResourceBundleName() is " + presn); System.err.println(prefix + ".parent.getResourceBundle() is " + pres); System.err.println(" expected parent getResourceBundleName() is " + expectedParent.getResourceBundleName()); System.err.println(" expected parent.getResourceBundle() is " + expectedParent.getResourceBundle()); }
Example 9
Source File: TestSetResourceBundle.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) { final String logName = logger.getName(); final String prefix = " " + logName; System.err.println("Logger " + logName + " logged with bundle name " + handler.lastBundleName + " (" + handler.lastBundle + ")"); System.err.println(prefix + ".getResourceBundleName() is " + logger.getResourceBundleName()); System.err.println(prefix + ".getResourceBundle() is " + logger.getResourceBundle()); final Logger parent = logger.getParent(); final String pname = parent == null ? null : parent.getName(); final String pclass = parent == null ? "" : ("(" + parent.getClass().getName() + ")"); final String presn = parent == null ? null : parent.getResourceBundleName(); final ResourceBundle pres = parent == null ? null : parent.getResourceBundle(); System.err.println(prefix + ".getParent() is " + pname + (pname == null ? "" : (" " + pclass + ": " + parent))); System.err.println(" expected parent is :" + expectedParent); System.err.println(prefix + ".parent.getResourceBundleName() is " + presn); System.err.println(prefix + ".parent.getResourceBundle() is " + pres); System.err.println(" expected parent getResourceBundleName() is " + expectedParent.getResourceBundleName()); System.err.println(" expected parent.getResourceBundle() is " + expectedParent.getResourceBundle()); }
Example 10
Source File: TestSetResourceBundle.java From hottub with GNU General Public License v2.0 | 5 votes |
static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) { final String logName = logger.getName(); final String prefix = " " + logName; System.err.println("Logger " + logName + " logged with bundle name " + handler.lastBundleName + " (" + handler.lastBundle + ")"); System.err.println(prefix + ".getResourceBundleName() is " + logger.getResourceBundleName()); System.err.println(prefix + ".getResourceBundle() is " + logger.getResourceBundle()); final Logger parent = logger.getParent(); final String pname = parent == null ? null : parent.getName(); final String pclass = parent == null ? "" : ("(" + parent.getClass().getName() + ")"); final String presn = parent == null ? null : parent.getResourceBundleName(); final ResourceBundle pres = parent == null ? null : parent.getResourceBundle(); System.err.println(prefix + ".getParent() is " + pname + (pname == null ? "" : (" " + pclass + ": " + parent))); System.err.println(" expected parent is :" + expectedParent); System.err.println(prefix + ".parent.getResourceBundleName() is " + presn); System.err.println(prefix + ".parent.getResourceBundle() is " + pres); System.err.println(" expected parent getResourceBundleName() is " + expectedParent.getResourceBundleName()); System.err.println(" expected parent.getResourceBundle() is " + expectedParent.getResourceBundle()); }
Example 11
Source File: TestSetResourceBundle.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) { final String logName = logger.getName(); final String prefix = " " + logName; System.err.println("Logger " + logName + " logged with bundle name " + handler.lastBundleName + " (" + handler.lastBundle + ")"); System.err.println(prefix + ".getResourceBundleName() is " + logger.getResourceBundleName()); System.err.println(prefix + ".getResourceBundle() is " + logger.getResourceBundle()); final Logger parent = logger.getParent(); final String pname = parent == null ? null : parent.getName(); final String pclass = parent == null ? "" : ("(" + parent.getClass().getName() + ")"); final String presn = parent == null ? null : parent.getResourceBundleName(); final ResourceBundle pres = parent == null ? null : parent.getResourceBundle(); System.err.println(prefix + ".getParent() is " + pname + (pname == null ? "" : (" " + pclass + ": " + parent))); System.err.println(" expected parent is :" + expectedParent); System.err.println(prefix + ".parent.getResourceBundleName() is " + presn); System.err.println(prefix + ".parent.getResourceBundle() is " + pres); System.err.println(" expected parent getResourceBundleName() is " + expectedParent.getResourceBundleName()); System.err.println(" expected parent.getResourceBundle() is " + expectedParent.getResourceBundle()); }
Example 12
Source File: TestLoggerBundleSync.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@Override public void run() { try { handler.setLevel(Level.FINEST); while (goOn) { Logger l; Logger foo = Logger.getLogger("foo"); Logger bar = Logger.getLogger("foo.bar"); for (long i=0; i < nextLong.longValue() + 100 ; i++) { if (!goOn) break; l = Logger.getLogger("foo.bar.l"+i); final ResourceBundle b = l.getResourceBundle(); final String name = l.getResourceBundleName(); if (b != null) { if (!name.equals(b.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +b.getBaseBundleName()); } } Logger ll = Logger.getLogger(l.getName()+".bie.bye"); ResourceBundle hrb; String hrbName; if (handler.getLevel() != Level.FINEST) { throw new RuntimeException("Handler level is not finest: " + handler.getLevel()); } final int countBefore = handler.count; handler.reset(); ll.setLevel(Level.FINEST); ll.addHandler(handler); ll.log(Level.FINE, "dummy {0}", this); ll.removeHandler(handler); final int countAfter = handler.count; if (countBefore == countAfter) { throw new RuntimeException("Handler not called for " + ll.getName() + "("+ countAfter +")"); } hrb = handler.rb; hrbName = handler.rbName; if (name != null) { // if name is not null, then it implies that it // won't change, since setResourceBundle() cannot // replace a non null name. // Since we never set the resource bundle on 'll', // then ll must inherit its resource bundle [name] // from l - and therefor we should find it in // handler.rb/handler.rbName if (!name.equals(hrbName)) { throw new RuntimeException("Unexpected bundle name: " +hrbName); } // here we know that hrbName is not null so hrb // should not be null either. if (!name.equals(hrb.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +hrb.getBaseBundleName()); } } // Make sure to refer to 'l' explicitly in order to // prevent eager garbage collecting before the end of // the test (JDK-8030192) if (!ll.getName().startsWith(l.getName())) { throw new RuntimeException("Logger " + ll.getName() + "does not start with expected prefix " + l.getName()); } getRBcount.incrementAndGet(); if (!goOn) break; Thread.sleep(1); } } } catch (Exception x) { fail(x); } }
Example 13
Source File: TestLoggerBundleSync.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Override public void run() { try { handler.setLevel(Level.FINEST); while (goOn) { Logger l; Logger foo = Logger.getLogger("foo"); Logger bar = Logger.getLogger("foo.bar"); for (long i=0; i < nextLong.longValue() + 100 ; i++) { if (!goOn) break; l = Logger.getLogger("foo.bar.l"+i); final ResourceBundle b = l.getResourceBundle(); final String name = l.getResourceBundleName(); if (b != null) { if (!name.equals(b.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +b.getBaseBundleName()); } } Logger ll = Logger.getLogger(l.getName()+".bie.bye"); ResourceBundle hrb; String hrbName; if (handler.getLevel() != Level.FINEST) { throw new RuntimeException("Handler level is not finest: " + handler.getLevel()); } final int countBefore = handler.count; handler.reset(); ll.setLevel(Level.FINEST); ll.addHandler(handler); ll.log(Level.FINE, "dummy {0}", this); ll.removeHandler(handler); final int countAfter = handler.count; if (countBefore == countAfter) { throw new RuntimeException("Handler not called for " + ll.getName() + "("+ countAfter +")"); } hrb = handler.rb; hrbName = handler.rbName; if (name != null) { // if name is not null, then it implies that it // won't change, since setResourceBundle() cannot // replace a non null name. // Since we never set the resource bundle on 'll', // then ll must inherit its resource bundle [name] // from l - and therefor we should find it in // handler.rb/handler.rbName if (!name.equals(hrbName)) { throw new RuntimeException("Unexpected bundle name: " +hrbName); } // here we know that hrbName is not null so hrb // should not be null either. if (!name.equals(hrb.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +hrb.getBaseBundleName()); } } // Make sure to refer to 'l' explicitly in order to // prevent eager garbage collecting before the end of // the test (JDK-8030192) if (!ll.getName().startsWith(l.getName())) { throw new RuntimeException("Logger " + ll.getName() + "does not start with expected prefix " + l.getName()); } getRBcount.incrementAndGet(); if (!goOn) break; Thread.sleep(1); } } } catch (Exception x) { fail(x); } }
Example 14
Source File: TestLoggerBundleSync.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@Override public void run() { try { handler.setLevel(Level.FINEST); while (goOn) { Logger l; Logger foo = Logger.getLogger("foo"); Logger bar = Logger.getLogger("foo.bar"); for (long i=0; i < nextLong.longValue() + 100 ; i++) { if (!goOn) break; l = Logger.getLogger("foo.bar.l"+i); final ResourceBundle b = l.getResourceBundle(); final String name = l.getResourceBundleName(); if (b != null) { if (!name.equals(b.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +b.getBaseBundleName()); } } Logger ll = Logger.getLogger(l.getName()+".bie.bye"); ResourceBundle hrb; String hrbName; if (handler.getLevel() != Level.FINEST) { throw new RuntimeException("Handler level is not finest: " + handler.getLevel()); } final int countBefore = handler.count; handler.reset(); ll.setLevel(Level.FINEST); ll.addHandler(handler); ll.log(Level.FINE, "dummy {0}", this); ll.removeHandler(handler); final int countAfter = handler.count; if (countBefore == countAfter) { throw new RuntimeException("Handler not called for " + ll.getName() + "("+ countAfter +")"); } hrb = handler.rb; hrbName = handler.rbName; if (name != null) { // if name is not null, then it implies that it // won't change, since setResourceBundle() cannot // replace a non null name. // Since we never set the resource bundle on 'll', // then ll must inherit its resource bundle [name] // from l - and therefor we should find it in // handler.rb/handler.rbName if (!name.equals(hrbName)) { throw new RuntimeException("Unexpected bundle name: " +hrbName); } // here we know that hrbName is not null so hrb // should not be null either. if (!name.equals(hrb.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +hrb.getBaseBundleName()); } } // Make sure to refer to 'l' explicitly in order to // prevent eager garbage collecting before the end of // the test (JDK-8030192) if (!ll.getName().startsWith(l.getName())) { throw new RuntimeException("Logger " + ll.getName() + "does not start with expected prefix " + l.getName()); } getRBcount.incrementAndGet(); if (!goOn) break; Thread.sleep(1); } } } catch (Exception x) { fail(x); } }
Example 15
Source File: TestLoggerBundleSync.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public void run() { try { handler.setLevel(Level.FINEST); while (goOn) { Logger l; Logger foo = Logger.getLogger("foo"); Logger bar = Logger.getLogger("foo.bar"); for (long i=0; i < nextLong.longValue() + 100 ; i++) { if (!goOn) break; l = Logger.getLogger("foo.bar.l"+i); final ResourceBundle b = l.getResourceBundle(); final String name = l.getResourceBundleName(); if (b != null) { if (!name.equals(b.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +b.getBaseBundleName()); } } Logger ll = Logger.getLogger(l.getName()+".bie.bye"); ResourceBundle hrb; String hrbName; if (handler.getLevel() != Level.FINEST) { throw new RuntimeException("Handler level is not finest: " + handler.getLevel()); } final int countBefore = handler.count; handler.reset(); ll.setLevel(Level.FINEST); ll.addHandler(handler); ll.log(Level.FINE, "dummy {0}", this); ll.removeHandler(handler); final int countAfter = handler.count; if (countBefore == countAfter) { throw new RuntimeException("Handler not called for " + ll.getName() + "("+ countAfter +")"); } hrb = handler.rb; hrbName = handler.rbName; if (name != null) { // if name is not null, then it implies that it // won't change, since setResourceBundle() cannot // replace a non null name. // Since we never set the resource bundle on 'll', // then ll must inherit its resource bundle [name] // from l - and therefor we should find it in // handler.rb/handler.rbName if (!name.equals(hrbName)) { throw new RuntimeException("Unexpected bundle name: " +hrbName); } // here we know that hrbName is not null so hrb // should not be null either. if (!name.equals(hrb.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +hrb.getBaseBundleName()); } } // Make sure to refer to 'l' explicitly in order to // prevent eager garbage collecting before the end of // the test (JDK-8030192) if (!ll.getName().startsWith(l.getName())) { throw new RuntimeException("Logger " + ll.getName() + "does not start with expected prefix " + l.getName()); } getRBcount.incrementAndGet(); if (!goOn) break; Thread.sleep(1); } } } catch (Exception x) { fail(x); } }
Example 16
Source File: TestLoggerBundleSync.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public void run() { try { handler.setLevel(Level.FINEST); while (goOn) { Logger l; Logger foo = Logger.getLogger("foo"); Logger bar = Logger.getLogger("foo.bar"); for (long i=0; i < nextLong.longValue() + 100 ; i++) { if (!goOn) break; l = Logger.getLogger("foo.bar.l"+i); final ResourceBundle b = l.getResourceBundle(); final String name = l.getResourceBundleName(); if (b != null) { if (!name.equals(b.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +b.getBaseBundleName()); } } Logger ll = Logger.getLogger(l.getName()+".bie.bye"); ResourceBundle hrb; String hrbName; if (handler.getLevel() != Level.FINEST) { throw new RuntimeException("Handler level is not finest: " + handler.getLevel()); } final int countBefore = handler.count; handler.reset(); ll.setLevel(Level.FINEST); ll.addHandler(handler); ll.log(Level.FINE, "dummy {0}", this); ll.removeHandler(handler); final int countAfter = handler.count; if (countBefore == countAfter) { throw new RuntimeException("Handler not called for " + ll.getName() + "("+ countAfter +")"); } hrb = handler.rb; hrbName = handler.rbName; if (name != null) { // if name is not null, then it implies that it // won't change, since setResourceBundle() cannot // replace a non null name. // Since we never set the resource bundle on 'll', // then ll must inherit its resource bundle [name] // from l - and therefor we should find it in // handler.rb/handler.rbName if (!name.equals(hrbName)) { throw new RuntimeException("Unexpected bundle name: " +hrbName); } // here we know that hrbName is not null so hrb // should not be null either. if (!name.equals(hrb.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +hrb.getBaseBundleName()); } } // Make sure to refer to 'l' explicitly in order to // prevent eager garbage collecting before the end of // the test (JDK-8030192) if (!ll.getName().startsWith(l.getName())) { throw new RuntimeException("Logger " + ll.getName() + "does not start with expected prefix " + l.getName()); } getRBcount.incrementAndGet(); if (!goOn) break; Thread.sleep(1); } } } catch (Exception x) { fail(x); } }
Example 17
Source File: TestLoggerBundleSync.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public void run() { try { handler.setLevel(Level.FINEST); while (goOn) { Logger l; Logger foo = Logger.getLogger("foo"); Logger bar = Logger.getLogger("foo.bar"); for (long i=0; i < nextLong.longValue() + 100 ; i++) { if (!goOn) break; l = Logger.getLogger("foo.bar.l"+i); final ResourceBundle b = l.getResourceBundle(); final String name = l.getResourceBundleName(); if (b != null) { if (!name.equals(b.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +b.getBaseBundleName()); } } Logger ll = Logger.getLogger(l.getName()+".bie.bye"); ResourceBundle hrb; String hrbName; if (handler.getLevel() != Level.FINEST) { throw new RuntimeException("Handler level is not finest: " + handler.getLevel()); } final int countBefore = handler.count; handler.reset(); ll.setLevel(Level.FINEST); ll.addHandler(handler); ll.log(Level.FINE, "dummy {0}", this); ll.removeHandler(handler); final int countAfter = handler.count; if (countBefore == countAfter) { throw new RuntimeException("Handler not called for " + ll.getName() + "("+ countAfter +")"); } hrb = handler.rb; hrbName = handler.rbName; if (name != null) { // if name is not null, then it implies that it // won't change, since setResourceBundle() cannot // replace a non null name. // Since we never set the resource bundle on 'll', // then ll must inherit its resource bundle [name] // from l - and therefor we should find it in // handler.rb/handler.rbName if (!name.equals(hrbName)) { throw new RuntimeException("Unexpected bundle name: " +hrbName); } // here we know that hrbName is not null so hrb // should not be null either. if (!name.equals(hrb.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +hrb.getBaseBundleName()); } } // Make sure to refer to 'l' explicitly in order to // prevent eager garbage collecting before the end of // the test (JDK-8030192) if (!ll.getName().startsWith(l.getName())) { throw new RuntimeException("Logger " + ll.getName() + "does not start with expected prefix " + l.getName()); } getRBcount.incrementAndGet(); if (!goOn) break; Thread.sleep(1); } } } catch (Exception x) { fail(x); } }
Example 18
Source File: TestLoggerBundleSync.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public void run() { try { handler.setLevel(Level.FINEST); while (goOn) { Logger l; Logger foo = Logger.getLogger("foo"); Logger bar = Logger.getLogger("foo.bar"); for (long i=0; i < nextLong.longValue() + 100 ; i++) { if (!goOn) break; l = Logger.getLogger("foo.bar.l"+i); final ResourceBundle b = l.getResourceBundle(); final String name = l.getResourceBundleName(); if (b != null) { if (!name.equals(b.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +b.getBaseBundleName()); } } Logger ll = Logger.getLogger(l.getName()+".bie.bye"); ResourceBundle hrb; String hrbName; if (handler.getLevel() != Level.FINEST) { throw new RuntimeException("Handler level is not finest: " + handler.getLevel()); } final int countBefore = handler.count; handler.reset(); ll.setLevel(Level.FINEST); ll.addHandler(handler); ll.log(Level.FINE, "dummy {0}", this); ll.removeHandler(handler); final int countAfter = handler.count; if (countBefore == countAfter) { throw new RuntimeException("Handler not called for " + ll.getName() + "("+ countAfter +")"); } hrb = handler.rb; hrbName = handler.rbName; if (name != null) { // if name is not null, then it implies that it // won't change, since setResourceBundle() cannot // replace a non null name. // Since we never set the resource bundle on 'll', // then ll must inherit its resource bundle [name] // from l - and therefor we should find it in // handler.rb/handler.rbName if (!name.equals(hrbName)) { throw new RuntimeException("Unexpected bundle name: " +hrbName); } // here we know that hrbName is not null so hrb // should not be null either. if (!name.equals(hrb.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +hrb.getBaseBundleName()); } } // Make sure to refer to 'l' explicitly in order to // prevent eager garbage collecting before the end of // the test (JDK-8030192) if (!ll.getName().startsWith(l.getName())) { throw new RuntimeException("Logger " + ll.getName() + "does not start with expected prefix " + l.getName()); } getRBcount.incrementAndGet(); if (!goOn) break; Thread.sleep(1); } } } catch (Exception x) { fail(x); } }
Example 19
Source File: TestLoggerBundleSync.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public void run() { try { handler.setLevel(Level.FINEST); while (goOn) { Logger l; Logger foo = Logger.getLogger("foo"); Logger bar = Logger.getLogger("foo.bar"); for (long i=0; i < nextLong.longValue() + 100 ; i++) { if (!goOn) break; l = Logger.getLogger("foo.bar.l"+i); final ResourceBundle b = l.getResourceBundle(); final String name = l.getResourceBundleName(); if (b != null) { if (!name.equals(b.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +b.getBaseBundleName()); } } Logger ll = Logger.getLogger(l.getName()+".bie.bye"); ResourceBundle hrb; String hrbName; if (handler.getLevel() != Level.FINEST) { throw new RuntimeException("Handler level is not finest: " + handler.getLevel()); } final int countBefore = handler.count; handler.reset(); ll.setLevel(Level.FINEST); ll.addHandler(handler); ll.log(Level.FINE, "dummy {0}", this); ll.removeHandler(handler); final int countAfter = handler.count; if (countBefore == countAfter) { throw new RuntimeException("Handler not called for " + ll.getName() + "("+ countAfter +")"); } hrb = handler.rb; hrbName = handler.rbName; if (name != null) { // if name is not null, then it implies that it // won't change, since setResourceBundle() cannot // replace a non null name. // Since we never set the resource bundle on 'll', // then ll must inherit its resource bundle [name] // from l - and therefor we should find it in // handler.rb/handler.rbName if (!name.equals(hrbName)) { throw new RuntimeException("Unexpected bundle name: " +hrbName); } // here we know that hrbName is not null so hrb // should not be null either. if (!name.equals(hrb.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +hrb.getBaseBundleName()); } } // Make sure to refer to 'l' explicitly in order to // prevent eager garbage collecting before the end of // the test (JDK-8030192) if (!ll.getName().startsWith(l.getName())) { throw new RuntimeException("Logger " + ll.getName() + "does not start with expected prefix " + l.getName()); } getRBcount.incrementAndGet(); if (!goOn) break; Thread.sleep(1); } } } catch (Exception x) { fail(x); } }
Example 20
Source File: TestLoggerBundleSync.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Override public void run() { try { handler.setLevel(Level.FINEST); while (goOn) { Logger l; Logger foo = Logger.getLogger("foo"); Logger bar = Logger.getLogger("foo.bar"); for (long i=0; i < nextLong.longValue() + 100 ; i++) { if (!goOn) break; l = Logger.getLogger("foo.bar.l"+i); final ResourceBundle b = l.getResourceBundle(); final String name = l.getResourceBundleName(); if (b != null) { if (!name.equals(b.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +b.getBaseBundleName()); } } Logger ll = Logger.getLogger(l.getName()+".bie.bye"); ResourceBundle hrb; String hrbName; if (handler.getLevel() != Level.FINEST) { throw new RuntimeException("Handler level is not finest: " + handler.getLevel()); } final int countBefore = handler.count; handler.reset(); ll.setLevel(Level.FINEST); ll.addHandler(handler); ll.log(Level.FINE, "dummy {0}", this); ll.removeHandler(handler); final int countAfter = handler.count; if (countBefore == countAfter) { throw new RuntimeException("Handler not called for " + ll.getName() + "("+ countAfter +")"); } hrb = handler.rb; hrbName = handler.rbName; if (name != null) { // if name is not null, then it implies that it // won't change, since setResourceBundle() cannot // replace a non null name. // Since we never set the resource bundle on 'll', // then ll must inherit its resource bundle [name] // from l - and therefor we should find it in // handler.rb/handler.rbName if (!name.equals(hrbName)) { throw new RuntimeException("Unexpected bundle name: " +hrbName); } // here we know that hrbName is not null so hrb // should not be null either. if (!name.equals(hrb.getBaseBundleName())) { throw new RuntimeException("Unexpected bundle name: " +hrb.getBaseBundleName()); } } // Make sure to refer to 'l' explicitly in order to // prevent eager garbage collecting before the end of // the test (JDK-8030192) if (!ll.getName().startsWith(l.getName())) { throw new RuntimeException("Logger " + ll.getName() + "does not start with expected prefix " + l.getName()); } getRBcount.incrementAndGet(); if (!goOn) break; Thread.sleep(1); } } } catch (Exception x) { fail(x); } }