(Quick Reference)

4.1.3.1 Logger Names

Version: 3.3.1

4.1.3.1 Logger Names

Grails artifacts (controllers, services …​) get injected a log property automatically.

Prior to Grails 3.3.0, the name of the logger for Grails Artifact followed the convention grails.app.<type>.<className>, where type is the type of the artifact, for example, controllers or services, and className is the fully qualified name of the artifact.

Grails 3.3.x simplifies logger names as illustrated in the next table:

Class Name

Package Name

Location

Annotated with @Slf4j

Logger Name (Grails 3.3.x or higher)

Logger Name (Grails 3.2.x or lower)

BookController.groovy

com.company

grails-app/controllers/com/company

NO

com.company.BookController

grails.app.controllers.com.company.BookController

BookController.groovy

com.company

grails-app/controllers/com/company

YES

com.company.BookController

com.company.BookController

BookService.groovy

com.company

grails-app/services/com/company

NO

com.company.BookService

grails.app.services.com.company.BookService

BookService.groovy

com.company

grails-app/services/com/company

YES

com.company.BookService

com.company.BookService

BookDetail.groovy

com.company

src/main/groovy/com/company

YES

com.company.BookDetail

com.company.BookDetail