Showing the changes to java/pkg/java/util/logging/LoggingProxyImpl.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,107 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2009, 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 | package java.util.logging; | ||
| 27 | |||
| 28 | import sun.util.logging.LoggingProxy; | ||
| 29 | |||
| 30 | /** | ||
| 31 | * Implementation of LoggingProxy when java.util.logging classes exist. | ||
| 32 | */ | ||
| 33 | class LoggingProxyImpl implements LoggingProxy { | ||
| 34 | static final LoggingProxy INSTANCE = new LoggingProxyImpl(); | ||
| 35 | |||
| 36 | private LoggingProxyImpl() { } | ||
| 37 | |||
| 38 | @Override | ||
| 39 | public Object getLogger(String name) { | ||
| 40 | return Logger.getLogger(name); | ||
| 41 | } | ||
| 42 | |||
| 43 | @Override | ||
| 44 | public Object getLevel(Object logger) { | ||
| 45 | return ((Logger) logger).getLevel(); | ||
| 46 | } | ||
| 47 | |||
| 48 | @Override | ||
| 49 | public void setLevel(Object logger, Object newLevel) { | ||
| 50 | ((Logger) logger).setLevel((Level) newLevel); | ||
| 51 | } | ||
| 52 | |||
| 53 | @Override | ||
| 54 | public boolean isLoggable(Object logger, Object level) { | ||
| 55 | return ((Logger) logger).isLoggable((Level) level); | ||
| 56 | } | ||
| 57 | |||
| 58 | @Override | ||
| 59 | public void log(Object logger, Object level, String msg) { | ||
| 60 | ((Logger) logger).log((Level) level, msg); | ||
| 61 | } | ||
| 62 | |||
| 63 | @Override | ||
| 64 | public void log(Object logger, Object level, String msg, Throwable t) { | ||
| 65 | ((Logger) logger).log((Level) level, msg, t); | ||
| 66 | } | ||
| 67 | |||
| 68 | @Override | ||
| 69 | public void log(Object logger, Object level, String msg, Object... params) { | ||
| 70 | ((Logger) logger).log((Level) level, msg, params); | ||
| 71 | } | ||
| 72 | |||
| 73 | @Override | ||
| 74 | public java.util.List<String> getLoggerNames() { | ||
| 75 | return LogManager.getLoggingMXBean().getLoggerNames(); | ||
| 76 | } | ||
| 77 | |||
| 78 | @Override | ||
| 79 | public String getLoggerLevel(String loggerName) { | ||
| 80 | return LogManager.getLoggingMXBean().getLoggerLevel(loggerName); | ||
| 81 | } | ||
| 82 | |||
| 83 | @Override | ||
| 84 | public void setLoggerLevel(String loggerName, String levelName) { | ||
| 85 | LogManager.getLoggingMXBean().setLoggerLevel(loggerName, levelName); | ||
| 86 | } | ||
| 87 | |||
| 88 | @Override | ||
| 89 | public String getParentLoggerName(String loggerName) { | ||
| 90 | return LogManager.getLoggingMXBean().getParentLoggerName(loggerName); | ||
| 91 | } | ||
| 92 | |||
| 93 | @Override | ||
| 94 | public Object parseLevel(String levelName) { | ||
| 95 | return Level.parse(levelName); | ||
| 96 | } | ||
| 97 | |||
| 98 | @Override | ||
| 99 | public String getLevelName(Object level) { | ||
| 100 | return ((Level) level).getName(); | ||
| 101 | } | ||
| 102 | |||
| 103 | @Override | ||
| 104 | public String getProperty(String key) { | ||
| 105 | return LogManager.getLogManager().getProperty(key); | ||
| 106 | } | ||
| 107 | } | ||