Logging in Groovy Script

You can have the below pattern in your script (tried in Groovy Editor).

import java.util.logging.Logger

Logger logger = Logger.getLogger("")
logger.info ("I am a test info log")

The above logs output to STDOUT. In order to log it to a file, you have to create a logger using getLogger. Follow the API for your convenience.

Leave a Comment