[slf4j-dev] [Bug 133] Add ability to log at a dynamic level

bugzilla-daemon at qos.ch bugzilla-daemon at qos.ch
Wed Feb 6 04:46:54 CET 2013


http://bugzilla.slf4j.org/show_bug.cgi?id=133

Matthew Hall <mhall at mhcomputing.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mhall at mhcomputing.net

--- Comment #6 from Matthew Hall <mhall at mhcomputing.net> 2013-02-06 04:46:53 CET ---
Hello gentlemen,

I have a MUCH simpler use case for this feature that is important in an
application and not just in libraries. I have many cases where I am writing
code which performs security validation of input data.

99% of the time the messages coming in will be valid, thus boring, and should
be logged at a very low level such as TRACE so you can enable viewing them in
the production code to see what's being validated in case there is a problem
somewhere.

But 1% of the time you find something bad in the input, because some hacker or
user has tried entering something crazy to find an exploit. It would be very
nice if the exact same message can be logged as before, but at a lot higher
severity so you know that something bad happened, without having duplicated
calls for everything which could be good or could be bad at runtime, which is
silly.

Example of how I've done this before in many lines of code I've written using
JDK and Log4J instead of SLF4J.

boolean isOk = isXFieldValid && isYFieldValid && isZFieldValid;

log.dynamic(isOk? TRACE : WARN, "isXFieldValid {} isYFieldValid {}
isZFieldValid", isXFieldValid, isYFieldValid, isZFieldValid);

Could we please reconsider this and think of a good solution?

Thanks,
Matthew.

-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the slf4j-dev mailing list