< prev index next >
src/java.logging/share/classes/java/util/logging/LogManager.java
Print this page
*** 396,408 ****
// 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);
}
--- 396,406 ----
// Create and retain Logger for the root of the namespace.
owner.addLogger(root);
// For backward compatibility: add any handlers configured using
// ".handlers"
! addInitialRootLoggerHandlers();
// Initialize level if not yet initialized
if (!root.isLevelInitialized()) {
root.setLevel(defaultLevel);
}
*** 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 {
--- 991,1018 ----
closeOnResetLoggers.addIfAbsent(CloseOnReset.create(logger));
}
}
}
! /**
! * Invoked when the root logger is initialized.
! * This method is called only once, when the root logger is initialized.
! * The default implementation of this method will instantiate
! * any handlers defined by the {@code ".handlers"} property and add
! * them to the root logger.
! * <p>
! * Subclasses of {@code LogManager} may override this method
! * to turn off this behavior, by providing an empty method body.
! */
! protected void addInitialRootLoggerHandlers() {
! createLoggerHandlers("", ".handlers")
! .stream()
! .forEach(rootLogger::addHandler);
! }
!
! 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 {
< prev index next >