001    /*****************************************************************************
002     * Copyright (C) PicoContainer Organization. All rights reserved.            *
003     * ------------------------------------------------------------------------- *
004     * The software in this package is published under the terms of the BSD      *
005     * style license a copy of which has been included with this distribution in *
006     * the LICENSE.txt file.                                                     *
007     *                                                                           *
008     *****************************************************************************/
009    package org.picocontainer.gems.injectors;
010    
011    import org.picocontainer.injectors.FactoryInjector;
012    import org.picocontainer.PicoContainer;
013    import org.picocontainer.PicoCompositionException;
014    import org.apache.log4j.Logger;
015    import org.apache.log4j.LogManager;
016    
017    import java.lang.reflect.Type;
018    
019    /**
020     * This will Inject a Log4J Logger for the injectee's class name
021     */
022    public class Log4JInjector extends FactoryInjector<Logger> {
023    
024        @Override
025            public Logger getComponentInstance(final PicoContainer container, final Type into) throws PicoCompositionException {
026            return LogManager.getLogger(((Class) into));
027        }
028    
029    }
030