[Bug 289] New: Add a NOOP method org.apache.log4j.Logger.setLevel() to enhance the bridging of Log4J over SLF4J

http://bugzilla.slf4j.org/show_bug.cgi?id=289 Summary: Add a NOOP method org.apache.log4j.Logger.setLevel() to enhance the bridging of Log4J over SLF4J Product: SLF4J Version: unspecified Platform: PC OS/Version: Mac OS X 10.3 Status: NEW Severity: enhancement Priority: P1 Component: log4j-over-slf4j AssignedTo: slf4j-dev@qos.ch ReportedBy: mspetrovic@gmail.com As a user of SLF4J who wants to bridge Log4J, I would like a org.apache.log4j.Logger.setLevel() method that is a NOOP implementation. Currently, this method does not exist on the org.apache.log4j.Logger class, and this causes a runtime exception to be thrown when 3rd party applications call legacy the method Logger.setLevel(Level lvl). Thanks. -- 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=289 rupert THURNER <rupert.thurner@credit-suisse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rupert.thurner@credit-suiss | |e.com --- Comment #1 from rupert THURNER <rupert.thurner@credit-suisse.com> --- would it be not better to have this in slf4j and have a real operation? for the providers not supporting it can have no effect. -- You are receiving this mail because: You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=289 Robert Elliot <robert@teviotia.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |robert@teviotia.co.uk --- Comment #2 from Robert Elliot <robert@teviotia.co.uk> --- I think it should very much not be in the SLF4J API because it's not the right level of abstraction - it mixes logging a statement (SLF4J's responsibility) with controlling what actually happens to those log statements at runtime (the implementation's responsibility). As I see it the problem here is that code that should not be taking responsibility for setting log levels is doing so. Adding the same function to SLF4J would just encourage people to commit this kind of error using SLF4J as well. -- You are receiving this mail because: You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=289 --- Comment #3 from rupert THURNER <rupert.thurner@credit-suisse.com> --- good point, did not consider this effect, but i can very much follow that line of argumentation. how would you design unit test code correctly so the output of reasonable error messages for different log levels are tested? -- You are receiving this mail because: You are the assignee for the bug.

http://bugzilla.slf4j.org/show_bug.cgi?id=289 --- Comment #4 from Robert Elliot <robert@teviotia.co.uk> --- Assuming you're using Maven, declare a test scoped dependency on an implementation and get the actual implementation's logger out in your unit tests - it will have a method for setting levels on it. You might want to consider slf4j-test - http://projects.lidalia.org.uk/slf4j-test/ . Disclaimer - I wrote it! -- You are receiving this mail because: You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@qos.ch