org.jboss.logmanager.LogManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jboss-logmanager-embedded Show documentation
Show all versions of jboss-logmanager-embedded Show documentation
Relocation of the JBoss LogManager artifact
/*
* Copyright 2018 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logmanager;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
/**
* Simplified log manager. Designed to work around the (many) design flaws of the JDK platform log manager.
*/
public final class LogManager extends java.util.logging.LogManager {
/**
* Construct a new logmanager instance. Attempts to plug a known memory leak in {@link java.util.logging.Level} as
* well.
*/
public LogManager() {
}
// Configuration
/**
* Configure the log manager one time.
*/
public void readConfiguration() throws IOException, SecurityException {
}
/**
* Configure the log manager.
*
* @param inputStream the input stream from which the logmanager should be configured
*/
public void readConfiguration(InputStream inputStream) throws IOException, SecurityException {
}
/**
* Do nothing. Properties and their listeners are not supported.
*
* @param l ignored
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
// no operation - properties are never changed
}
/**
* Do nothing. Properties and their listeners are not supported.
*
* @param l ignored
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
// no operation - properties are never changed
}
/**
* Does nothing. Properties are not supported.
*
* @param name ignored
* @return {@code null}
*/
public String getProperty(String name) {
// no properties
return null;
}
/**
* Does nothing. This method only causes trouble.
*/
public void reset() {
// no operation!
}
@Override
public Enumeration getLoggerNames() {
return LogContext.getInstance().getLoggerNames();
}
/**
* Do nothing. Loggers are only added/acquired via {@link #getLogger(String)}.
*
* @param logger ignored
* @return {@code false}
*/
public boolean addLogger(java.util.logging.Logger logger) {
return false;
}
/**
* Get or create a logger with the given name.
*
* @param name the logger name
* @return the corresponding logger
*/
public Logger getLogger(String name) {
return LogContext.getInstance().getLogger(name);
}
}