Is there any replacement for LoggigManager.setLevel()

(Ruben Laguna) #1

Is it possible to change the logging.level within a task?

apply plugin: java
task logLevel << {
  logging.level = 'ERROR' // to supress logging statements regardless of -q , etc. 
  logger.warn 'WARN message'
  logger.error 'ERROR message'

Give a warning message:

LoggingManager.setLevel(LogLevel) has been deprecated and is scheduled to be removed in Gradle 3.0. If you are using this method to expose Ant logging messages, please use AntBuilder.setLifecycleLogLevel() instead.

Is not clear to me if it’s just logging.level that is deprecated or is the whole possibility of changing the level from with a task that is deprecated. I mean is there a non deprecated way to do this?