< prev index next >

src/java.logging/share/classes/java/util/logging/LogManager.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 394,409 **** owner.readPrimordialConfiguration(); // Create and retain Logger for the root of the namespace. owner.addLogger(root); - // For backward compatibility: add any handlers configured using - // ".handlers" - owner.createLoggerHandlers("", ".handlers") - .stream() - .forEach(root::addHandler); - // Initialize level if not yet initialized if (!root.isLevelInitialized()) { root.setLevel(defaultLevel); } --- 394,403 ----
*** 993,1003 **** closeOnResetLoggers.addIfAbsent(CloseOnReset.create(logger)); } } } ! private List<Handler> createLoggerHandlers(final String name, final String handlersPropertyName) { String names[] = parseClassNames(handlersPropertyName); List<Handler> handlers = new ArrayList<>(names.length); for (String type : names) { try { --- 987,998 ---- closeOnResetLoggers.addIfAbsent(CloseOnReset.create(logger)); } } } ! private List<Handler> createLoggerHandlers(final String name, ! final String handlersPropertyName) { String names[] = parseClassNames(handlersPropertyName); List<Handler> handlers = new ArrayList<>(names.length); for (String type : names) { try {
*** 1173,1182 **** --- 1168,1183 ---- // a Logger object has been GC'ed so clean it up ref.dispose(); } } + @SuppressWarnings("deprecation") + private boolean isSpecialLogger(Logger logger) { + assert logger != null; + return logger == rootLogger || logger == Logger.global; + } + /** * Add a named logger. This does nothing and returns false if a logger * with the same name is already registered. * <p> * The Logger factory methods call this method to register each
*** 1201,1210 **** --- 1202,1225 ---- if (cx.addLocalLogger(logger)) { // Do we have a per logger handler too? // Note: this will add a 200ms penalty loadLoggerHandlers(logger, name, name + ".handlers"); return true; + } else if (isSpecialLogger(logger) + && !initializationDone + && initializedCalled + && configurationLock.isHeldByCurrentThread()) { + // Called just after reading the primordial configuration, in + // the same thread that read it. + // The root and global logger would already be present in the context + // by this point, but we would not have called loadLoggerHandlers + // yet. + // For backward compatibility: add any handlers configured using + // ".handlers" to the root logger, or any handlers configured + // with "global.handlers" to the global logger. + loadLoggerHandlers(logger, name, name + ".handlers"); + return true; } else { return false; } }
< prev index next >