Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

relation between log4j and apache.commons.logging

Tags:

logging

log4j

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 ??

like image 357
Pawan Avatar asked Dec 13 '11 11:12

Pawan


People also ask

Is commons-logging same as Log4j?

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.

Does commons-logging contain Log4j?

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.

Is Apache Commons Logging affected by Log4j vulnerability?

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.

Is Apache using Log4j?

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.


1 Answers

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

like image 151
TMtech Avatar answered Sep 30 '22 11:09

TMtech