|
Java example source code file (SLF4JLogFactory.java)
The SLF4JLogFactory.java Java example source code/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.logging.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogConfigurationException; import org.apache.commons.logging.LogFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.spi.LocationAwareLogger; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; /** * <p> * Concrete subclass of {@link LogFactory} which always delegates to the * {@link LoggerFactory org.slf4j.LoggerFactory} class. * * <p> * This factory generates instances of {@link SLF4JLog}. It will remember * previously created instances for the same name, and will return them on * repeated requests to the <code>getInstance() method. * * <p> * This implementation ignores any configured attributes. * </p> * * @author Rod Waldhoff * @author Craig R. McClanahan * @author Richard A. Sitze * @author Ceki Gülcü */ @SuppressWarnings("rawtypes") public class SLF4JLogFactory extends LogFactory { // ----------------------------------------------------------- Constructors /** * The {@link org.apache.commons.logging.Log}instances that have already been * created, keyed by logger name. */ ConcurrentMap<String, Log> loggerMap; /** * Public no-arguments constructor required by the lookup mechanism. */ public SLF4JLogFactory() { loggerMap = new ConcurrentHashMap<String, Log>(); } // ----------------------------------------------------- Manifest Constants /** * The name of the system property identifying our {@link Log}implementation * class. */ public static final String LOG_PROPERTY = "org.apache.commons.logging.Log"; // ----------------------------------------------------- Instance Variables /** * Configuration attributes. */ protected Hashtable attributes = new Hashtable(); // --------------------------------------------------------- Public Methods /** * Return the configuration attribute with the specified name (if any), or * <code>null if there is no such attribute. * * @param name * Name of the attribute to return */ public Object getAttribute(String name) { return (attributes.get(name)); } /** * Return an array containing the names of all currently defined configuration * attributes. If there are no such attributes, a zero length array is * returned. */ @SuppressWarnings("unchecked") public String[] getAttributeNames() { List<String> names = new ArrayList Other Java examples (source code examples)Here is a short list of links related to this Java SLF4JLogFactory.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.