Could anybody please tell me what's the relation between log4j and apache.commons.logging ? which one is more popular and better ?
I have imported an existing Application in which they have imported import org.apache.commons.logging.LogFactory;
and written a separate class called Log
and overridden some of the methods as critical
, warn
, info
For instance
public static void info(String caller, String toWrite)
{
write(caller,toWrite,Log.INFO);
}
Could anybody please tell me is log4j and apache.commons.logging are different ??
log4j is a logging framework, i.e. it provides the code to log messages. Commons-logging is an abstraction layer for logging frameworks, it doesn't log anything itself.
The commons-logging. jar file includes the JCL API, the default LogFactory implementation and thin-wrapper Log implementations for Log4J, Avalon LogKit, the Avalon Framework's logging infrastructure, JDK 1.4, as well as an implementation of JDK 1.4 logging APIs (JSR-47) for pre-1.4 systems.
Applications using only the log4j-api JAR file without the log4j-core JAR file are not impacted by this vulnerability. Also note that Apache Log4j is the only Logging Services subproject affected by this vulnerability. Other projects like Log4net and Log4cxx are not impacted by this.
Apache Log4j 2 is an upgrade to Log4j that provides significant improvements over its predecessor, Log4j 1. x, and provides many of the improvements available in Logback while fixing some inherent problems in Logback's architecture.
log4j is a logging framework, i.e. it provides the code to log messages. Commons-logging is an abstraction layer for logging frameworks, it doesn't log anything itself. For example if I write code using commons logging and deploy it on JBoss, the logging is done by log4j, but if I deploy it on WebSphere logging is done by WebSphere's own logging implementation. If I run the same code as a stand alone application it Java's own logging that is used
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With