ALUMOM
ALUMOM

Reputation: 83

Whats the difference between log4j and apache commons logging?

I am very new to this and I am trying to add logging on our service end. I found that I can simply use the following for logging:

<code>
    private Log logger = LogFactory.getFactory()
        .getInstance(MyClass.class);
    logger.debug("test1234");
</code>

Then I also found another framework called log4j which I am not sure if is useful to me. I just want to know the difference between using log4j framework and apache commons logging. Thanks in advance

Upvotes: 1

Views: 4440

Answers (1)

Kayaman
Kayaman

Reputation: 73528

Apache Commons Logging is an abstraction that allows you to write logging code without caring about the actual logging implementation. This is especially useful when writing library code, since the user of your library may be using a different logging library than you are.

Note that commons logging is no longer recommended, SLF4J should be used instead. This comes from the author of commons logging, so it's pretty authoritative ;)

Upvotes: 3

Related Questions