I've set up some template utilities for jobs as described here:
https://github.com/jenkinsci/job-dsl-plugin/wiki/Real-World-Examples#import-other-files-ie-with-class-definitions-into-your-script
so all my actually job definitions look like:
import templates.TempletizedJob
new TempletizedJob(pipelineJob('myjob'), args)
I would like the TempletizedJob class to be able to log details of what is being configured, with the end goal being that I can use the log of the Job DSL seed job to answer questions like "how many jobs used feature X of TempletizedJob". (where "feature X" isn't something that can't just be easily grepped from the JobDSL definitions themselves).
Naively, I would just use "println" in the TemplatizedJob class, but this results in an error:
ERROR: Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods println java.lang.Object java.lang.Object
but that also throws security exceptions:
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod java.util.logging.Logger getLogger java.lang.String
Even if I pass `out` as an argument in my constructor from the job dsl script, I get:
ERROR: Scripts not permitted to use method java.io.PrintStream println java.lang.String
Is there any supported way of logging from utility classes that are imported into Job DSL scripts?