Я инициализировал при запуске и поместил log4j в папку META-INF.И просто используйте log4j без Slf4j.(EJB 3.1)
Надеюсь, приведенный ниже код поможет;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
@Singleton
@Startup
public class InitClass {
@PostConstruct
private void log4jIlkle() {
String log4jProp = yourlog4jPath;//My path definition maybe put more flexible path: "../applications/DeployName/META-INF/log4j.properties";
File logFile = new File(log4jProp);
if (logFile.exists()) {
System.out.println("Log4j init: " + log4jProp);
PropertyConfigurator.configure(log4jProp);
}
else {
System.err.println("*** " + log4jProp + " file not found, initialize with default settings");
BasicConfigurator.configure();
}
}
}