Gradle Logging: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 4: Line 4:
=Overview=
=Overview=


Gradle exposes access to its internal logging via the "logger" variable, which is available from [[settings.gradle]] and [[build.gradle]].
Gradle exposes access to its internal logging via the "logger" variable, which is available from [[settings.gradle]] and [[build.gradle]]. The underlying logging component exposes the standard SLF4J "error", "warn", "info", "debug" methods, as well as a few extra ones, like "quiet".
 
<syntaxhighlight lang='groovy'>
logger.quiet "this is info content that will always be sent to the stdout"
logger.error "this is error content that will be sent to stderr"
logger.warn "this is warning content will be sent to stdout"
logger.info "this is info content will be sent to stdout when --info is active"
logger.debug "this is debug content will be sent to stdout when --debug is active"
</syntaxhighlight>

Revision as of 23:46, 3 October 2020

Internal

Overview

Gradle exposes access to its internal logging via the "logger" variable, which is available from settings.gradle and build.gradle. The underlying logging component exposes the standard SLF4J "error", "warn", "info", "debug" methods, as well as a few extra ones, like "quiet".

 
logger.quiet "this is info content that will always be sent to the stdout"
logger.error "this is error content that will be sent to stderr"
logger.warn "this is warning content will be sent to stdout"
logger.info "this is info content will be sent to stdout when --info is active"
logger.debug "this is debug content will be sent to stdout when --debug is active"