org.apache.commons.discovery.defaults.MyLogFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-discovery Show documentation
Show all versions of commons-discovery Show documentation
Its an port to fix bugs in OSGi support. ... The Apache Commons Discovery 0.5 component is about discovering, or finding,
implementations for pluggable interfaces.
package org.apache.commons.discovery.defaults;
import java.util.Properties;
import org.apache.commons.discovery.log.SimpleLog;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogConfigurationException;
public class MyLogFactory extends org.apache.commons.logging.LogFactory {
private Properties attr = new Properties();
@Override
public Object getAttribute(String name) {
return attr.get(name);
}
@Override
public String[] getAttributeNames() {
return attr.keySet().toArray(new String[0]);
}
@Override
public Log getInstance(Class clazz) throws LogConfigurationException {
return new SimpleLog(clazz.getCanonicalName());
}
@Override
public Log getInstance(String name) throws LogConfigurationException {
return new SimpleLog(name);
}
@Override
public void release() {
}
@Override
public void removeAttribute(String name) {
attr.remove(name);
}
@Override
public void setAttribute(String name, Object value) {
attr.put(name, value);
}
}