#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.ejb;

import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LoggerProducer {
 
    @Produces
    public Logger getLogger(InjectionPoint injectionPoint) {
        return LoggerFactory.getLogger(
                              injectionPoint.getBean().getBeanClass());
    }
    
}
@@ -285,18 +285,17 @@
 ducer %7B%0A
- 
 %0A
+
     @Pro
@@ -373,112 +373,222 @@
     
-return LoggerFactory.getLogger(%0A                              injectionPoint.getBean().getBean
+Class%3C?%3E clazz;%0A        if (injectionPoint.getBean() != null) %7B%0A            clazz = injectionPoint.getBean().getBeanClass();%0A        %7D else %7B%0A            clazz = injectionPoint.getMember().getDeclaring
 Class()
-)
 ;%0A
+    
     
@@ -593,10 +593,58 @@
   %7D%0A    
+    return LoggerFactory.getLogger(clazz);%0A    %7D
 %0A%7D

Fix Logger injection in GlassFish 4