1 /** 2 This file is part of GoldenGate Project (named also GoldenGate or GG). 3 4 Copyright 2009, Frederic Bregier, and individual contributors by the @author 5 tags. See the COPYRIGHT.txt in the distribution for a full listing of 6 individual contributors. 7 8 All GoldenGate Project is free software: you can redistribute it and/or 9 modify it under the terms of the GNU General Public License as published 10 by the Free Software Foundation, either version 3 of the License, or 11 (at your option) any later version. 12 13 GoldenGate is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with GoldenGate . If not, see <http://www.gnu.org/licenses/>. 20 */ 21 package goldengate.common.logging; 22 23 import org.jboss.netty.logging.InternalLoggerFactory; 24 25 /** 26 * Based on the Netty InternalLoggerFactory Based on The Netty Project 27 * (netty-dev@lists.jboss.org) 28 * 29 * @author Trustin Lee (tlee@redhat.com) 30 * @author Frederic Bregier 31 * 32 */ 33 public abstract class GgInternalLoggerFactory extends 34 org.jboss.netty.logging.InternalLoggerFactory implements GgInternalLoggerInterface { 35 /** 36 * 37 * @param clazz 38 * @return the GgInternalLogger 39 */ 40 public static GgInternalLogger getLogger(Class<?> clazz) { 41 InternalLoggerFactory factory = getDefaultFactory(); 42 if (factory instanceof GgInternalLoggerInterface) { 43 return (GgInternalLogger) factory.newInstance(clazz.getName()); 44 } else { 45 // Should be set first so default = JDK support 46 InternalLoggerFactory.setDefaultFactory(new GgJdkLoggerFactory(null)); 47 return (GgInternalLogger) getDefaultFactory().newInstance( 48 clazz.getName()); 49 } 50 } 51 52 }