de.intarsys.tools.logging.CompositeHandlerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of isrt Show documentation
Show all versions of isrt Show documentation
The basic runtime tools and interfaces for intarsys components.
package de.intarsys.tools.logging;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Handler;
/**
* An {@link IHandlerFactory} that creates a {@link CompositeHandler} by
* delegating to a collection of other {@link IHandlerFactory} instances.
*
*/
public class CompositeHandlerFactory extends CommonHandlerFactory {
private List handlerFactories = new ArrayList();
public void addLogHandlerFactory(IHandlerFactory factory) {
handlerFactories.add(factory);
}
@Override
protected Handler basicCreateHandler() throws IOException {
CompositeHandler handler = new CompositeHandler();
for (IHandlerFactory factory : handlerFactories) {
handler.addHandler(factory.createLogHandler());
}
return handler;
}
public void removeLogHandlerFactory(IHandlerFactory factory) {
handlerFactories.remove(factory);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy