Can we use different logging library in alfresco?

Showing results for 
Search instead for 
Did you mean: 
Member II

Can we use different logging library in alfresco?

I would like to use logback or at least  log4j 2.

1 Reply

Re: Can we use different logging library in alfresco?

Yes, technically it is possible. Alfresco already includes SLF4J and a bridge for Commons Logging to redirect via SLF4J to Log4j. If you wanted to use logback, you'd only need to replace the Log4j library shipped with Alfresco with a log4j-slf4j bridge, and of course add the logback configuration. Similar with Log4j2.

In order to avoid any startup error, you should override / remove the Log4J hierarchy initialisation. By doing that, you are losing the ability to have extensions (in Repository) provide their own logging configuration as their will not be read anymore. Additionally, tools like the "Log4j Settings" in Alfresco Support Tools / OOTBee Support Tools addons will stop to work.

I use logback in most of my Alfresco unit tests, and prefer it over the old Log4j shipped with Alfresco. I haven't looked at Log4j2 too much to know if I should / might want to prefer that instead.

TL;DR - Switching logging library in Alfresco is possible, but comes with some caveats. it is definitely not something that Alfresco (the company) supports.