[all] Use slf4j and SimpleLogger#3789
Conversation
Support "--debug" flag for slf4j-simple
This is a hacky way: It reconfigures SimpleLogger to use a special print stream. What ever is printed there is forwarded to ant's project logger. Removed the deprecated and now unused classes in net.sourceforge.pmd.util.log.
Generated by 🚫 Danger |
This is at least needed for apex jorje, but might be handy for any other library that logs through jul.
Need to remove all handlers first, as java by default adds a ConsoleLogger. The SLF4JBridgeHandler should be the only handler registered.
Co-authored-by: Clément Fournier <clement.fournier76@gmail.com>
|
@oowekyala: I'll merge in the other PR (#3794) into this one - as it will only build as a whole. Then this PR will get a bit big unfortunately... |
Co-authored-by: Clément Fournier <clement.fournier76@gmail.com>
This theoretically allows to use "-Dorg.slf4j.simpleLogger.defaultLogLevel=trace" manually Still log the current default log level (verified in BinaryDistributionIT)
otherwise debug log level is enabled for later tests
Sounds like a plan. The PmdLogger in #3785 is not really needed on master, so I'd suggest to remove it there and add it on 7.0.x after the merge. Note: Currently in the pmd-java build in the unit tests, something is setting the default log level to DEBUG at some point and doesn't reset it. I see a lot of |
This provides a default configuration that will be used when resetting the logger configuration in CLITests or PMDTaskTest. Without this, slf4j-simple will keep the last configured default level. Now it will use the default level configured in simplelogger. Since pmd-test is not part of the distribution, this configuration file has no effect for the binaries.
I solved it now by adding a default simplelogger.properties in pmd-test. This will be used, when we reset the configuration after a test, that messed with the configuration (to verify, that the --debug flag actually works). That way, it will now reset to whatever is configured in simplelogger.properties. |
Describe the PR
net.sourceforge.pmd.util.loggerare removed now (they were now unused).net.sourceforge.pmd.PMDis now migrated to use slf4jOpen Tasks:
Ready?
./mvnw clean verifypasses (checked automatically by github actions)