]> git.mxchange.org Git - jcore-logger-ejb.git/blob - src/java/org/mxchange/jcoreeelogger/beans/local/logger/LoggerFactory.java
Log and LoggerFactory must still reside in same package ... Well, the beans.xml did...
[jcore-logger-ejb.git] / src / java / org / mxchange / jcoreeelogger / beans / local / logger / LoggerFactory.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.jcoreeelogger.beans.local.logger;
18
19 import javax.enterprise.inject.Produces;
20 import javax.enterprise.inject.spi.InjectionPoint;
21 import org.apache.logging.log4j.LogManager;
22 import org.apache.logging.log4j.Logger;
23
24 /**
25  * A logger factory
26  *
27  * @author Roland Haeder
28  */
29 public class LoggerFactory {
30
31         /**
32          * Own logger
33          */
34         private final Logger logger;
35
36         /**
37          * Factory method
38          */
39         public LoggerFactory () {
40                 this.logger = LogManager.getLogger(this.getClass().getName());
41         }
42
43         @Produces
44         @Log
45         public Logger getLogger (final InjectionPoint caller) {
46                 return LogManager.getLogger(caller.getMember().getDeclaringClass().getName());
47         }
48 }