How to access --stacktrace or --full-stacktrace option in custom plugin


I am writing a custom plugin (for adapting a third party library). In the plugin code I catch all exceptions thrown from the library, to continue with the next input.

The question is: how can I find out if the user has specified the --stacktrace or --full-stacktrace option when running gradle, so that I can print the stacktraces of those exceptions only if the user has asked for it?


I would probably use a Logger so a user could increase verbosity with --info or --debug.

--stacktrace and --full-stacktrace really controls what kind of output Gradle prints at the end of the build. If you’re talking about collecting exceptions and then failing at the end, if you attach your exceptions as causes to the final exception you throw, it should just work.