[slf4j-user] Sigar and log4j-over-slf4j
David Alves
davidralves at gmail.com
Thu Dec 30 02:24:30 CET 2010
Hi
I'm using Sigar (native system metrics gathering API) with log4j-over-slf4j and it crashed on start with:
java.lang.NoSuchMethodError: org.apache.log4j.Logger.getAllAppenders()Ljava/util/Enumeration;
at org.hyperic.sigar.SigarLog.isLogConfigured(SigarLog.java:40)
at org.hyperic.sigar.SigarLog.getLogger(SigarLog.java:49)
at org.hyperic.sigar.SigarLog.getLogger(SigarLog.java:44)
at org.hyperic.sigar.SigarLog.debug(SigarLog.java:60)
at org.hyperic.sigar.Sigar.<clinit>(Sigar.java:108)
...
This because the Category class in log4j-over-slf4j (from whom Logger descends) does not contain the getAllAppenders() method which is a known and somewhat used hack to test wether log4j was initialized.
I got the project from git and added this mock method to the Category class:
public Enumeration getAllAppenders() {
return new Enumeration() {
public Object nextElement() {
return null;
}
public boolean hasMoreElements() {
return false;
}
};
}
All works fine now. It would be cool if the main version would support this.
Btw nice work on slf4j. Got to love open source :))
Regards
David Alves
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-user/attachments/20101230/0005916e/attachment.html>
More information about the slf4j-user
mailing list