Issue Details (XML | Word | Printable)

Key: JCR-215
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Jukka Zitting
Reporter: Ragy Eleish
Votes: 2
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Jackrabbit Content Repository

Code depends on Log4J directly

Created: 15/Sep/05 03:07 AM   Updated: 13/Jul/06 05:48 PM
Return to search
Component/s: None
Affects Version/s: 0.9
Fix Version/s: 1.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works jackrabbit.slf4j.patch 2005-09-29 07:19 AM Jukka Zitting 90 kB
Text File Licensed for inclusion in ASF works jackrabbit.slf4j.r293110.patch 2005-10-02 10:43 PM Jukka Zitting 91 kB

Resolution Date: 15/Mar/06 03:42 PM


 Description  « Hide
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.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jukka Zitting added a comment - 15/Sep/05 03:44 AM
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?

[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/

Jukka Zitting added a comment - 21/Sep/05 12:32 AM
Marked for 1.0 and changed issue type from bug to improvement.

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().

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.

Jukka Zitting added a comment - 15/Mar/06 03:42 PM
Merged to 1.0 in revision 385991.

Stefan Guggisberg added a comment - 13/Jul/06 05:48 PM
cleaning up "Open Issues" list