groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: `this` in static context
Date Mon, 06 Nov 2017 17:59:09 GMT
You should be able to call `name` or `canonicalName` or `sinpleName` directly if there are
no static methods in the class or its supers that would take precedence.

class LongClassName {
  private static Logger log = Logger.getLogger(name)
  private static Logger log = Logger.getLogger(this) // another possibility for frameworks
that accept a class instance for logger namespacing
-- although this particular case has been much simplified by @Log, et al.
View raw message