1 /* 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 /** 27 * <b>[JDK INTERNAL]</b> 28 * The {@code sun.util.logger} package defines an internal provider 29 * whose default naive implementation is replaced by the {@code java.logging} 30 * module when the {@code java.logging} module is present. 31 * <p> 32 * <b>Default Implementation</b> 33 * <p> 34 * The JDK default implementation of the System.LoggerFinder will attempt to 35 * load an installed instance of the {@link sun.util.logger.JdkLoggerProvider} 36 * defined in this package. 37 * When the {@code java.util.logging} package is present, this will usually 38 * resolve to an instance of {@link sun.util.logging.internal.JdkLoggingProvider} - 39 * which provides an implementation of the Logger whose backend is a 40 * {@link java.util.logging.Logger java.util.logging.Logger}. 41 * Configuration can thus be performed by direct access to the regular 42 * {@code java.util.logging} APIs, 43 * using {@link java.util.logging.Logger java.util.logging.Logger} and 44 * {@link java.util.logging.LogManager} to access and configure the backend 45 * Loggers. 46 * <br> 47 * If however {@code java.util.logging} is not linked with the application, then 48 * the default implementation will return a simple logger that will print out 49 * all log messages of INFO level and above to the console ({@code System.err}), 50 * as implemented by the base {@link sun.util.logger.JdkLoggerProvider} class. 51 * <p> 52 * <b>Message Levels and Mapping to java.util.logging</b> 53 * <p> 54 * The {@link java.lang.System.LoggerFinder} class documentation describe how 55 * {@linkplain java.lang.System.Logger.Level System.Logger levels} are mapped 56 * to {@linkplain java.util.logging.Level JUL levels} when {@code 57 * java.util.logging} is the backend. 58 * <p> 59 * <b>Migrating From {@code java.util.logging}</b> 60 * <p> 61 * When migrating a class from logging through {@code java.util.logging} to 62 * logging through the {@link java.lang.System.Logger System Loggers}, there are two 63 * choices: 64 * <ol> 65 * <li>You can use the {@link sun.util.logging.PlatformLogger} which will 66 * forward log events through a logger obtained from the LoggerFinder - but 67 * this will bind you to an internal API, and the PlatformLogger only support 68 * a small subset of the methods defined on {@code java.util.logging.Logger}. 69 * </li> 70 * <li>The other possibility is to obtain a {@link java.lang.System.Logger 71 * System.Logger} instance from the factory methods defined in 72 * {@link java.lang.System java.lang.System}, and modify 73 * all the log statements in the class. This requires more work, but will make 74 * the class use a public and supported interface, as well as making it 75 * independent from {@code java.util.logging}, even when 76 * {@code java.util.logging} is the backend. 77 * </li> 78 * </ol> 79 * 80 * @see sun.util.logger.JdkLoggerProvider 81 * @see sun.util.logging.internal.JdkLoggingProvider 82 * @see java.lang.System.LoggerFinder 83 * @see java.lang.System.Logger 84 * @see sun.util.logging.PlatformLoggerBridge 85 * @see sun.util.logging.internal 86 * 87 * @since 1.9 88 */ 89 package sun.util.logger;