2 * Copyright (C) 2016, 2017 Free Software Foundation
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as
6 * published by the Free Software Foundation, either version 3 of the
7 * License, or (at your option) any later version.
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 Affero General Public License for more details.
14 * You should have received a copy of the GNU Affero General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jcoreeelogger.beans.local.logger;
19 import javax.ejb.Singleton;
20 import javax.ejb.Startup;
21 import javax.inject.Inject;
22 import org.apache.logging.log4j.Logger;
25 * A "centralized" logger bean
27 * @author Roland Häder<roland@mxchange.org>
30 @Singleton (name = "logger", description = "A centralized logger bean")
31 public class LoggerBean implements LoggerBeanLocal {
36 private static final long serialVersionUID = 186_978_639_741_260L;
43 private Logger logger;
48 public LoggerBean () {
52 public void logDebug (final String message) {
54 this.getLogger().debug(message);
58 public void logDebug (final String message, final Throwable cause) {
60 this.getLogger().debug(message, cause);
64 public void logError (final String message) {
66 this.getLogger().error(message);
70 public void logError (final String message, final Throwable cause) {
72 this.getLogger().error(message, cause);
76 public void logException (final Throwable throwable) {
78 this.getLogger().catching(throwable);
82 public void logFatal (final String message, final Throwable cause) {
84 this.getLogger().fatal(message, cause);
88 public void logFatal (final String message) {
90 this.getLogger().fatal(message);
94 public void logInfo (final String message) {
96 this.getLogger().info(message);
100 public void logInfo (final String message, final Throwable cause) {
101 // Deligate to logger
102 this.getLogger().info(message, cause);
106 public void logTrace (final String message) {
107 // Deligate to logger
108 this.getLogger().trace(message);
112 public void logTrace (final String message, final Throwable cause) {
113 // Deligate to logger
114 this.getLogger().trace(message, cause);
118 public void logWarning (final String message) {
119 // Deligate to logger
120 this.getLogger().warn(message);
124 public void logWarning (final String message, final Throwable cause) {
125 // Deligate to logger
126 this.getLogger().warn(message, cause);
134 private Logger getLogger () {