[Bug 225] New: log4j-over-slf4j Compatibility Enhancements: PropertyConfigurator, DOMConfigurator, NDC.

http://bugzilla.slf4j.org/show_bug.cgi?id=225 Summary: log4j-over-slf4j Compatibility Enhancements: PropertyConfigurator, DOMConfigurator, NDC. Product: SLF4J Version: 1.6.x Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P1 Component: log4j-over-slf4j AssignedTo: slf4j-dev@qos.ch ReportedBy: jmsteward@gmail.com I'm currently developing a new project for my employer and recently made the decision to replace log4j with slf4j & logback. However as close as I came to completing this replacement I have finally come to terms with its impracticability and will need to unfortunately undo my changes & revert to log4j. The reason is because we have a number of first-party reusable "component" libraries that have been around for a decade or so. My new project, like many many of our other projects, require some parts of these legacy components. Because of the sheer number of scattered projects dependent on these components I am absolutely unable to alter any of their code. So I setup my new project with slf4j-api-1.6.1.jar, slf4j-ext-1.6.1.jar, logback-classic-0.9.29.jar & logback-core-0.9.29.jar, and I setup the legacy components to use log4j-over-slf4j-1.6.1.jar, slf4j-api-1.6.1.jar & slf4j-ext-1.6.1.jar. PropertyConfigurator Issue: A class used by many other projects for universal logging configuration exists in one of these component libraries and it uses org.apache.log4j.PropertyConfigurator. Although my project does not use the aforementioned class, it does require other classes from the library in question. Per reading through slf4j documentation I understand PropertyConfigurator is intended not to be supported. I understand the decision not to support its functionality but it doesn't make much sense to me that it should prevent code from compiling. I just need to be able to compile this code using log4j-over-slf4j, whether or not PropertyConfigurator is fully functional is a non-issue as my project does not use it, though other projects do use it and log4j will likely indefinitely remain in their classpaths'. So I propose a "bare bones" class be created at org.apache.log4j.PropertyConfigurator within log4j-over-slf4j. While it doesn't affect me I think it makes sense for org.apache.log4j.xml.DOMConfigurator too. Although I do see that org.apache.log4j.xml.DOMConfigurator does exist in the slf4j repository. Is that a sign this is being addressed? NDC Issue: This is a similar issue, where NDC is used within a legacy component, but my project also relies on that legacy usage of NDC for its contents to ultimately be apart of the log's pattern. This is subsequently used for reporting purposes. I came across the bug, that I can now not locate, where org.slf4j.NDC was added to slf4j-ext built atop org.slf4j.MDC with some basic functionality. NDC compiled fine using log4j-over-slf4j so I thought I was in the clear. I went ahead and wrote a class extending ClassicConverter that emulates log4j's NDC pattern so my new project that was using logback could output the NDC contents that the legacy component was controlling through org.apache.log4j.NDC. Nothing outputted to my log from the NDC pattern. I determined my NdcConverter class, conversion rule, and pattern were all correct. The break is between log4j-over-slf4j's org.apache.log4j.NDC and slf4j-ext's org.slf4j.NDC. org.apache.log4j.NDC is purely "bare bones" with all the methods but nothing within them. It doesn't make sense NDC, also seemingly unofficially supported by slf4j, has functionality in slf4j-ext but not the legacy bridge log4j-over-slf4j. This should be resolved in a similar manner as log4j-over-slf4j's org.apache.log4j.MDC and slf4j-api's org.slf4j.MDC where the former's methods call the latter's methods. Or would it be better design for the org.apache.log4j classes (MDC & NDC) to extend their org.slf4j countparts? I found Bug 170 that dismisses this NDC idea due to ... "This would require a slf4j-ext dependency in log4j-over-slf4j. Because of that, log4j-over-slf4j would then require Java>=1.5." ... Has a log4j-over-slf4j-ext component been considered? Perhaps you could migrate the loosely supported items to such a component; e.g. org.apache.log4j.NDC, org.apache.log4j.PropertyConfigurator & org.apache.log4j.xml.DOMConfigurator. While I'm designing things to be portable and allow for our legacy libraries to be purged and switched out with brand new code, it is not a possibility any time soon. I require those libraries to get other more crucial parts of the project into production. So slf4j is not an option for me despite my preference for it. These scenarios are not unique to me and I hope slf4j addresses them so it can become a more realistic option for those transitioning out of legacy code bases. Happy trails. -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=225 Ceki Gulcu <listid@qos.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |listid@qos.ch --- Comment #1 from Ceki Gulcu <listid@qos.ch> 2011-06-23 20:09:53 CEST --- Hello, Could you send a patch with the missing methods or classes, e.g. PropertyConfigurator and DOMConfigurator, were added? Regarding org.log4j.NDC, how about adding the missing functionality in terms of slf4j's MDC similar to the way it is done in slf4j-ext? I would appreciate if you could send such a patch... -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=225 jmsteward@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |227 --- Comment #2 from jmsteward@gmail.com 2011-06-24 17:33:10 CEST --- In order to satisfy all non-private methods of org.apache.log4j.xml.DOMConfigurator, per its method "protected Layout parseLayout(org.w3c.dom.Element)" org.apache.log4j.api.Layout should be moved to org.apache.log4j.Layout. -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=225 --- Comment #3 from jmsteward@gmail.com 2011-06-24 19:13:21 CEST --- Created attachment 74 --> http://bugzilla.slf4j.org/attachment.cgi?id=74 org.apache.log4j.BasicConfigurator Realized BasicConfigurator should be grouped into this compatibility bug. -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=225 --- Comment #4 from jmsteward@gmail.com 2011-06-24 19:14:44 CEST --- Created attachment 75 --> http://bugzilla.slf4j.org/attachment.cgi?id=75 org.apache.log4j.PropertyConfigurator -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=225 --- Comment #5 from jmsteward@gmail.com 2011-06-24 19:17:34 CEST --- Created attachment 76 --> http://bugzilla.slf4j.org/attachment.cgi?id=76 org.apache.log4j.config.PropertySetter Required to satisfy all non-private methods of org.apache.log4j.xml.DOMConfigurator. -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=225 --- Comment #6 from jmsteward@gmail.com 2011-06-24 19:19:03 CEST --- Created attachment 77 --> http://bugzilla.slf4j.org/attachment.cgi?id=77 org.apache.log4j.spi.ThrowableRenderer Required to satisfy all non-private methods of org.apache.log4j.xml.DOMConfigurator. -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=225 --- Comment #7 from jmsteward@gmail.com 2011-06-24 19:20:08 CEST --- Created attachment 78 --> http://bugzilla.slf4j.org/attachment.cgi?id=78 org.apache.log4j.xml.DOMConfigurator -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=225 --- Comment #8 from jmsteward@gmail.com 2011-06-24 19:46:17 CEST --- Created attachment 79 --> http://bugzilla.slf4j.org/attachment.cgi?id=79 org.apache.log4j.NDC Hello Ceki. Per your suggestion org.apache.log4j.NDC borrows and duplicates the existing code from org.slf4j.NDC. I literally coalesced these two existing classes together unchanged and nothing more. Perhaps this should be revisited at a later time so the same functionality isn't duplicated in multiple spots? In order to ensure these two classes behave identically overtime. Thank you. Josh -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=225 Ceki Gulcu <listid@qos.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #9 from Ceki Gulcu <listid@qos.ch> 2011-07-07 22:36:54 CEST --- Thanks for the patches. Merged them in http://github.com/ceki/slf4j/commit/8a329393cca7f5 -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@pixie.qos.ch