Copyright (c) 2004-2011 QOS.ch
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The
LoggerFactory is a utility class producing Loggers for
various logging APIs, most notably for log4j, logback and JDK 1.4 logging.
Other implementations such as
NOPLogger and
SimpleLogger are also supported.
LoggerFactory is essentially a wrapper around an
ILoggerFactory instance bound with LoggerFactory at
compile time.
Please note that all methods in LoggerFactory are static.
- Author(s):
- Ceki Gülcü
- Robert Elliot
It is LoggerFactory's responsibility to track version changes and manage
the compatibility list.
It is assumed that all versions in the 1.6 are mutually compatible.
Force LoggerFactory to consider itself uninitialized.
This method is intended to be called by classes (in the same package) for
testing purposes. This method is internal. It can be modified, renamed or
removed at any time without notice.
You are strongly discouraged from calling this method in production code.
if(msg.indexOf("org/slf4j/impl/StaticLoggerBinder") != -1) if(msg.indexOf("org.slf4j.impl.StaticLoggerBinder") != -1) private final static void bind() { .report("Failed to load class \"org.slf4j.impl.StaticLoggerBinder\"."); Util.report("Defaulting to no-operation (NOP) logger implementation"); + " for further details.");
if (msg != null && msg.indexOf("org.slf4j.impl.StaticLoggerBinder.getSingleton()") != -1) { Util.report("slf4j-api 1.6.x (or later) is incompatible with this binding."); Util.report("Your binding is version 1.5.5 or earlier."); Util.report("Upgrade your binding to version 1.6.x. or 2.0.x"); Util.report("Failed to instantiate SLF4J LoggerFactory", t); if (loggerNameList.size() == 0) { .report("The following loggers will not work because they were created"); .report("during the default configuration phase of the underlying logging system."); for (int i = 0; i < loggerNameList.size(); i++) { Util.report("The requested version " + requested + " by your slf4j binding is not compatible with "
Util.report("Unexpected problem occured during version sanity check", e); if (loggerFactoryClassLoader == null) { paths = loggerFactoryClassLoader
implementationSet.add(path);
if (implementationSet.size() > 1) { Util.report("Class path contains multiple SLF4J bindings."); Util.report("Found binding in [" + path + "]"); Util.report("Error getting resources from path", ioe); Return a logger named according to the name parameter using the statically
bound
ILoggerFactory instance.
- Parameters:
name
The name of the logger.- Returns:
- logger
Return a logger named corresponding to the class passed as parameter, using
the statically bound
ILoggerFactory instance.
- Parameters:
clazz
the returned logger will be named after clazz- Returns:
- logger
Return the
ILoggerFactory instance in use.
ILoggerFactory instance is bound with this class at compile time.
- Returns:
- the ILoggerFactory instance in use