< prev index next >

test/java/util/logging/SimpleLogManager.java

Print this page




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.util.*;
  25 import java.util.logging.*;
  26 import sun.util.logging.PlatformLogger;
  27 
  28 /*
  29  * @test
  30  * @bug 8005615
  31  * @summary A LogManager subclass overrides its own implementation of named
  32  *          logger (see the subclassing information in the Logger class specification)
  33  *

  34  * @compile -XDignore.symbol.file CustomLogManager.java SimpleLogManager.java
  35  * @run main/othervm -Djava.util.logging.manager=SimpleLogManager SimpleLogManager
  36  */
  37 public class SimpleLogManager extends CustomLogManager {
  38     public static void main(String[] args) {
  39         String classname = System.getProperty("java.util.logging.manager");
  40         if (!classname.equals("SimpleLogManager")) {
  41             throw new RuntimeException("java.util.logging.manager not set");
  42         }
  43 
  44         Logger logger = Logger.getLogger(SimpleLogManager.class.getName());
  45         Logger.getLogger("org.foo.bar.Foo");
  46 
  47         // a platform logger used by the system code is just a Logger instance.
  48         PlatformLogger.getLogger("org.openjdk.core.logger");
  49 
  50         LogManager mgr = LogManager.getLogManager();
  51         if (mgr != CustomLogManager.INSTANCE || !(mgr instanceof SimpleLogManager)) {
  52              throw new RuntimeException(LogManager.getLogManager() + " not SimpleLogManager");
  53         }




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.util.*;
  25 import java.util.logging.*;
  26 import sun.util.logging.PlatformLogger;
  27 
  28 /*
  29  * @test
  30  * @bug 8005615
  31  * @summary A LogManager subclass overrides its own implementation of named
  32  *          logger (see the subclassing information in the Logger class specification)
  33  *
  34  * @modules java.base/sun.util.logging
  35  * @compile -XDignore.symbol.file CustomLogManager.java SimpleLogManager.java
  36  * @run main/othervm -Djava.util.logging.manager=SimpleLogManager SimpleLogManager
  37  */
  38 public class SimpleLogManager extends CustomLogManager {
  39     public static void main(String[] args) {
  40         String classname = System.getProperty("java.util.logging.manager");
  41         if (!classname.equals("SimpleLogManager")) {
  42             throw new RuntimeException("java.util.logging.manager not set");
  43         }
  44 
  45         Logger logger = Logger.getLogger(SimpleLogManager.class.getName());
  46         Logger.getLogger("org.foo.bar.Foo");
  47 
  48         // a platform logger used by the system code is just a Logger instance.
  49         PlatformLogger.getLogger("org.openjdk.core.logger");
  50 
  51         LogManager mgr = LogManager.getLogManager();
  52         if (mgr != CustomLogManager.INSTANCE || !(mgr instanceof SimpleLogManager)) {
  53              throw new RuntimeException(LogManager.getLogManager() + " not SimpleLogManager");
  54         }


< prev index next >