> Now we are getting way off topic, but I would argue that a message that > contains no specific context information would still be a good message. > There is nothing wrong with a debug message of logger.debug(“User: {}, > userId); as this contains all the context information you need to determine > where it originated. > > Generally it is quite a PITA to constantly have to code: > > debug(“Performing action X in method foo in class “ + MyClass.class); >
1. We are talking about a library. 2. There are ways to access the stack if you really want to > It is also more expensive since you are doing String concatenation whether > you want debug messages or not. Logging frameworks exist to a) make logging > easier and b) to separate generating the log events from what happens with > them. > This is only a problem if you assume to be constantly logging everything - which you might be a fan of. I am not (for a library). > The other problem with using a simple debug() construct is that typically > you will have Application —> library1.method1 > —>library1.method2—>library2.method1—>library3.method1—>debug msg which > makes it difficult to determine where the message originated if the message > only contains general information about the error. Sorry - don't get that.