5731N/A/*
5731N/A * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
5731N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5731N/A *
5731N/A * This code is free software; you can redistribute it and/or modify it
5731N/A * under the terms of the GNU General Public License version 2 only, as
5731N/A * published by the Free Software Foundation.
5731N/A *
5731N/A * This code is distributed in the hope that it will be useful, but WITHOUT
5731N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5731N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5731N/A * version 2 for more details (a copy is included in the LICENSE file that
5731N/A * accompanied this code).
5731N/A *
5731N/A * You should have received a copy of the GNU General Public License version
5731N/A * 2 along with this work; if not, write to the Free Software Foundation,
5731N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5731N/A *
5731N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5731N/A * or visit www.oracle.com if you need additional information or have any
5731N/A * questions.
5731N/A */
5731N/A
5731N/Aimport java.io.*;
5731N/Aimport java.util.*;
5731N/A
5731N/Aimport java.util.logging.*;
5731N/Aimport sun.util.logging.PlatformLogger;
5731N/A
5731N/A/*
5731N/A * @test
5731N/A * @bug 8005615
5731N/A * @summary Add loggers to custom log manager
5731N/A *
5731N/A * @compile -XDignore.symbol.file CustomLogManagerTest.java CustomLogManager.java
5731N/A * @run main/othervm -Djava.util.logging.manager=CustomLogManager CustomLogManagerTest
5731N/A */
5731N/Apublic class CustomLogManagerTest {
5731N/A private static final String RESOURCE_BUNDLE = "sun.util.logging.resources.logging";
5731N/A public static void main(String[] args) {
5731N/A String mgr = System.getProperty("java.util.logging.manager");
5731N/A if (!mgr.equals("CustomLogManager")) {
5731N/A throw new RuntimeException("java.util.logging.manager not set");
5731N/A }
5731N/A
5731N/A Logger.getLogger(CustomLogManagerTest.class.getName());
5731N/A Logger.getLogger("org.foo.Foo");
5731N/A Logger.getLogger("org.foo.bar.Foo", RESOURCE_BUNDLE);
5731N/A // platform logger will be set with the default system resource bundle
5731N/A PlatformLogger.getLogger("org.openjdk.core.logger");
5731N/A
5731N/A if (LogManager.getLogManager() != CustomLogManager.INSTANCE) {
5731N/A throw new RuntimeException(LogManager.getLogManager() + " not CustomLogManager");
5731N/A }
5731N/A
5731N/A CustomLogManager.checkLogger(CustomLogManagerTest.class.getName());
5731N/A CustomLogManager.checkLogger("org.foo.Foo");
5731N/A CustomLogManager.checkLogger("org.foo.bar.Foo", RESOURCE_BUNDLE);
5731N/A CustomLogManager.checkLogger(Logger.GLOBAL_LOGGER_NAME);
5731N/A CustomLogManager.checkLogger("");
5731N/A CustomLogManager.checkLogger("org.openjdk.core.logger", RESOURCE_BUNDLE);
5731N/A }
5731N/A}