Alex Rivera | Logout

Is it worth wrapping a logging framework in an additional layer?

Asked 2009-06-10T23:47:41.937
23

I'm currently looking at upgrading the logging mechanism in a medium-to-large-sized Java codebase. Messages are currently logged using static methods on a Debug class, and I have recommended switching from this to something like SLF4J or commons-logging.

The application architect prefers that I encapsulate the dependency on SLF4J (possibly by wrapping it up in the aforementioned Debug class). This will make it easier to change the logging implementation in the future.

This seems like overkill to me, as SLF4J is already abstracting the concrete logging implementation.

Is it worth wrapping a 3rd-party logging abstraction like SLF4J in another home-grown abstraction?

Edit
Report

1 Answer

4

Explain to your Architecture Astronaut that slf4j already can act as a wrapper for other logging implementations, like log4j. So if you need to use some other logger in the future and there is no adapter for slf4j, you can write it when the need arises, but it will just be the adapter, instead of writing a whole logging framework that will just wrap some other logging framework and you need to design your framework for that and write your own adapter.

answered 2009-06-11T00:03:43.260

Your Answer