1

Is there a way to write into the server log from a groovlet script? I've tried the following to no avail:

  • Create a class with @Log4j annotation within the groovlet (@Log4j works fine in the rest of the project)
@Log4j('LOGGER')
class Log {
    static Logger getLogger() {
        LOGGER
    }
}
  • Use ServerContext instance implicit variable application:
application.log('Hello world')

Any ideas welcome, thanks.

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
m0skit0
  • 25,268
  • 11
  • 79
  • 127

1 Answers1

0

The logs didn't appear using the first method because of Log4j filtering on log4j.properties.

I created a separate class GroovletLogger inside one of our unfiltered packages and I can log fine from groovlets.

m0skit0
  • 25,268
  • 11
  • 79
  • 127