Factory for creating com.good.gd.apache.commons.logging.Log instances. Applications should call the makeNewLogInstance()
method to instantiate new instances of the configured com.good.gd.apache.commons.logging.Log implementation class.
By default, calling getInstance()
will use the following algorithm:
-
If Log4J is available, return an instance of
org.apache.commons.logging.impl.Log4JLogger
.
-
If JDK 1.4 or later is available, return an instance of
org.apache.commons.logging.impl.Jdk14Logger
.
-
Otherwise, return an instance of
org.apache.commons.logging.impl.NoOpLog
.
You can change the default behavior in one of two ways:
-
On the startup command line, set the system property
org.apache.commons.logging.log
to the name of the org.apache.commons.logging.Log
implementation class you want to use.
-
At runtime, call
LogSource.setLogImplementation()
.
- Deprecated:
- Use com.good.gd.apache.commons.logging.LogFactory instead - The default factory implementation performs exactly the same algorithm as this class did
- Author
- Rod Waldhoff
- Version
- Id
- LogSource.java 155426 2005-02-26 13:10:49Z dirkv
Notice
The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.
/*
* Copyright (C) 2006 The Android Open Source Project
*
* 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.
*/
|
static void | setLogImplementation (String classname) throws LinkageError, ExceptionInInitializerError, NoSuchMethodException, SecurityException, ClassNotFoundException |
| Set the log implementation/log implementation factory by the name of the class. More...
|
|
static void | setLogImplementation (Class logclass) throws LinkageError, ExceptionInInitializerError, NoSuchMethodException, SecurityException |
| Set the log implementation/log implementation factory by class. More...
|
|
static Log | getInstance (String name) |
| Get a Log instance by class name.
|
|
static Log | getInstance (Class clazz) |
| Get a Log instance by class.
|
|
static Log | makeNewLogInstance (String name) |
| Create a new com.good.gd.apache.commons.logging.Log implementation, based on the given name. More...
|
|
static String[] | getLogNames () |
| Returns a String array containing the names of all logs known to me.
|
|
static Log makeNewLogInstance |
( |
String |
name | ) |
|
|
static |
The specific com.good.gd.apache.commons.logging.Log implementation returned is determined by the value of the org.apache.commons.logging.log
property. The value of org.apache.commons.logging.log
may be set to the fully specified name of a class that implements the com.good.gd.apache.commons.logging.Log interface. This class must also have a public constructor that takes a single String argument (containing the name of the com.good.gd.apache.commons.logging.Log to be constructed.
When org.apache.commons.logging.log
is not set, or when no corresponding class can be found, this method will return a Log4JLogger if the log4j Logger class is available in the LogSource's classpath, or a Jdk14Logger if we are on a JDK 1.4 or later system, or NoOpLog if neither of the above conditions is true.
- Parameters
-
name | the log name (or category) |