how to handle logging in groovy scripts

cancel
Showing results for 
Search instead for 
Did you mean: 
klaasdeboer
Customer

how to handle logging in groovy scripts

Jump to solution

How can i access the logger from a groovy script?

Currently we use stdout (System.out.println("a log message")) in our groovy scripttasks. We want to move away from stdout logging and would like to use a the logger available in javascript scripttaks for example.

Or even better: can we define our own logfile and write to this?

1 Solution

Accepted Solutions
klaasdeboer
Customer

Re: how to handle logging in groovy scripts

Jump to solution

ok found out how to do it. Add the following to your script:

import org.slf4j.*;
Logger logger = LoggerFactory.getLogger("org.some.thing");
logger.debug("slf4j - logger.debug -- Hello world.");

View solution in original post

2 Replies
klaasdeboer
Customer

Re: how to handle logging in groovy scripts

Jump to solution

ok found out how to do it. Add the following to your script:

import org.slf4j.*;
Logger logger = LoggerFactory.getLogger("org.some.thing");
logger.debug("slf4j - logger.debug -- Hello world.");

EddieMay
Alfresco Employee

Re: how to handle logging in groovy scripts

Jump to solution

Hi @klaasdeboer ,

Thanks for posting this solution - will be helpful to other users.

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!