
26 Nov
2009
26 Nov
'09
4:55 p.m.
Hi Joern, Well, it's more of a java question than slf4j. The difference is between direct method call and a method call via reflection. The latter is known to be a bit slower and is also harder to read. There might also be subtle class loader differences. Joern Huxhorn wrote:
I was wondering if there is a real substantial difference between
a) ILoggerFactory factory=org.slf4j.impl.StaticLoggerBinder.getLoggerFactory();
and
b) ILoggerFactory factory=(ILoggerFactory) Class.forName("org.slf4j.impl.StaticLoggerBinder").getMethod("getLoggerFactory").invoke(null);
I mean, are the classes resolved any different?
Beside a compile-time error in case of a) if the class is missing, of course.
Regards, Joern.
-- Ceki