Set up Error Prone check to prevent use of native Gradle and Maven loggers
Using the native Gradle logger was probably why our deprecation messages were overwritten.
We should be careful not to make use of the native Maven or Gradle loggers. We can prevent misuse in ProjectProperties by just using consoleLogger. But it is very easy to accidentally use the native loggers in Maven mojos and Gradle tasks. Unfortunately, now I realized we had used the native loggers when printing deprecation notices.
That's weird, We shouldn't be overwriting any logs should we, even if it does use the native logger.
I think it's because of the progress bar
#2176 will fix wrong usage at the moment. But we should keep in mind that it is easy to accidentally do getLog() or getLogger() in mojos and tasks, because that's the only way to get a logger there.
But I think we should be using the native logger as much as we can... it helps us conform to whatever logging settings are set, no? Or am I missing something?
oh I see native logger vs our logging events?
We can add an errorprone check for this :)
I meant using ConsoleLogger that we create for the progress bar (enabled by default). ConsoleLogger sits on top of the native logger and makes use of it. But if we by-pass ConsoleLogger and go directly with the native logger, such output can be overwritten a mess because ConsoleLogger does frequent cursor-ups. If you see #2176, it might make more sense.
I don't know how can we prevent this with errorprone?
I think we can ask error prone to mark any use of the gradle logger or maven logger as unsafe in our codebase, just speculating though. (we would write this check)
I tried to see how Error Prone can be configured to detect this. Looks like we have to write a custom check in Java. This seems fairly involved. May need to create another Gradle sub-project. I'll rename this issue and add the "tech debt" label to be open.