The code is written against the Log4J APIs, which forces all users of Jackarabbit to pick up log4J dependency and to juggle with JDK logging and Log4J configuration if other components of the project uses JDK 1.4 logging.
If the code is move to depend on Apache commons-logging this issue will be resolved. Also this should be a minor fix.
Description
The code is written against the Log4J APIs, which forces all users of Jackarabbit to pick up log4J dependency and to juggle with JDK logging and Log4J configuration if other components of the project uses JDK 1.4 logging.
If the code is move to depend on Apache commons-logging this issue will be resolved. Also this should be a minor fix.
There was a discussion [1] on the mailing list about this early this year. The conclusion [2] was to wait for the toolkit-independent UGLI layer to mature.
Since then the UGLI project [3] has been renamed and moved to the Simple Logging Facade for Java (SLF4J) project [4] that is currently at beta 7 of version 1.0. The SLF4J beta jars are already available at the Ibiblio Maven repository.
I believe now would be a good time to migrate from log4j to slf4j. Any objections?
The attached patch replaces all log4j references with the equivalent slf4j code. The detailed changes are:
* Replace the log4j dependency with nlog4j in project.xml
* Replace org.apache.log4j.Logger with org.slf4j.Logger
* Replace org.apache.log4j.Logger.getLogger() with org.slf4j.LoggerFactory.getLogger()
* Replace org.apache.log4j.Logger.fatal() with org.slf4j.Logger.error()
* Adjust some log method arguments as required by the API change (e.g. Object -> String)
* Remove the (unused) ability to set log level in org.apache.jackrabbit.test.LogPrintWriter
Note that the last change touches the TCK test suite and can break test setups that specifically modify the logging level of test output. Perhaps we should keep using log4j for the test suite?
I used the slf4j-compliant nlog4j library as a dependency instead of the smaller slf4j alternatives. The nlog4j library is a slightly modified version of log4j, so this change should be mostly invisible to end users unless they want to switch to using some other logging framework with slf4j support.
I didn't commit these changes directly as there might yet be other opinions on this matter. If so, please comment this issue. Unless anyone objects, I'll commit the patch within a few days.
Jukka Zitting added a comment - 29/Sep/05 07:19 AM The attached patch replaces all log4j references with the equivalent slf4j code. The detailed changes are:
* Replace the log4j dependency with nlog4j in project.xml
* Replace org.apache.log4j.Logger with org.slf4j.Logger
* Replace org.apache.log4j.Logger.getLogger() with org.slf4j.LoggerFactory.getLogger()
* Replace org.apache.log4j.Logger.fatal() with org.slf4j.Logger.error()
* Adjust some log method arguments as required by the API change (e.g. Object -> String)
* Remove the (unused) ability to set log level in org.apache.jackrabbit.test.LogPrintWriter
Note that the last change touches the TCK test suite and can break test setups that specifically modify the logging level of test output. Perhaps we should keep using log4j for the test suite?
I used the slf4j-compliant nlog4j library as a dependency instead of the smaller slf4j alternatives. The nlog4j library is a slightly modified version of log4j, so this change should be mostly invisible to end users unless they want to switch to using some other logging framework with slf4j support.
I didn't commit these changes directly as there might yet be other opinions on this matter. If so, please comment this issue. Unless anyone objects, I'll commit the patch within a few days.
Marcel Reutegger added a comment - 29/Sep/05 05:16 PM IMO we should also replace the log4j dependency in LogPrintWriter and consequently remove the method setMsgLevel().
Updated the patch to apply cleanly to the latest sources (revision 293110). I'm having second thoughts about applying the patch just yet, as the slf4j 1.0 beta releases seem to have had some minor API changes along the way. It's probably better to wait for the official 1.0 release.
Jukka Zitting added a comment - 02/Oct/05 10:43 PM Updated the patch to apply cleanly to the latest sources (revision 293110). I'm having second thoughts about applying the patch just yet, as the slf4j 1.0 beta releases seem to have had some minor API changes along the way. It's probably better to wait for the official 1.0 release.
Jukka Zitting added a comment - 12/Mar/06 10:56 PM Switched to SLF4J 1.0 logging in revision 385280. Targetting for inclusion in 1.0 unless anyone runs into trouble with SLF4J.
Since then the UGLI project [3] has been renamed and moved to the Simple Logging Facade for Java (SLF4J) project [4] that is currently at beta 7 of version 1.0. The SLF4J beta jars are already available at the Ibiblio Maven repository.
I believe now would be a good time to migrate from log4j to slf4j. Any objections?
[1] http://thread.gmane.org/gmane.comp.apache.jackrabbit.devel/740
[2] http://article.gmane.org/gmane.comp.apache.jackrabbit.devel/898
[3] http://logging.apache.org/log4j/docs/ugli.html
[4] http://www.slf4j.org/