|
Simple Log 2.0.1
[grlea] |
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.slf4j.impl.MarkerIgnoringBase
org.grlea.log.adapters.slf4j.Slf4jAdapter
public class Slf4jAdapter
An adapter for using Simple Log within the SLF4J package.
Instructions for Use
To use this Slf4jAdapter with SLF4J, you should only need to include the JARs for
Simple Log (simple-log.jar) and for the SLF4J Adapter (simple-log-slf4j.jar) in your classpath
and use the SLF4J LoggerFactory to obtain log instances. Be careful not to confuse
'slf4j-simple.jar' as being part of the arrangement. It is a SLF4J deliverable that simply prints
output to System.out.
Implementation Details
The Slf4jAdapter always uses the
default SimpleLog. It is anticipated this will do the job for
the preverbial 99% of cases. If this is insufficient for your needs, please write to me and we
can try and find a more flexible solution.
The SLF4J levels map directly to the Simple Log levels:
| SLF4J | Simple Log |
|---|---|
Error | Error |
Warn | Warn |
Info | Info |
Debug | Debug |
"Tracing"
Note that the SLF4J has no notion of tracing whatsoever, so the tracing properties in Simple Log will have no bearing on the output.
Logger Names
The SLF4J API provides logger names that are Strings, while Simple Log prefers Class
objects for naming its loggers. This adapter tries to rectify the discord by attempting to
interpret logger names as fully qualified class names.
Where this is not possible (because the logger name is not a class name), a
SimpleLogger will be created using a source class of
org.slf4j.Logger and with the provided logger name as the instance ID of the logger.
(See SimpleLogger.SimpleLogger(Class, Object).
When the two-argument domain + sub-domain method is used and the domain is not a fully-qualified
class name, the domain and sub-domain are concatenated with a period ('.') in between, e.g.
"domain.subdomain", and this is used as the instance ID.
This means that, when writing properties to configure loggers that don't use class names, the
properties should take the form:
org.slf4j.Logger.<logger-name>
or
org.slf4j.Logger.<domain>.<subdomain>
When logger names cannot be interpreted as class names, each logger name that cannot be
interpreted will be printed with a warning to System.err. You can supress these warnings
by setting the system property org.grlea.log.adapters.slf4j.supressWarnings to
true.
Object Rendering
Messages submitted to the Slf4jAdapter using
the format + argument(s) methods are interpreted using the
MessageFormatter that is provided in SLF4J.
| Method Summary | |
|---|---|
void |
debug(java.lang.String message)
|
void |
debug(java.lang.String messageFormat,
java.lang.Object argument)
|
void |
debug(java.lang.String messageFormat,
java.lang.Object[] arguments)
|
void |
debug(java.lang.String messageFormat,
java.lang.Object argument1,
java.lang.Object argument2)
|
void |
debug(java.lang.String message,
java.lang.Throwable exception)
|
void |
error(java.lang.String message)
|
void |
error(java.lang.String messageFormat,
java.lang.Object argument)
|
void |
error(java.lang.String messageFormat,
java.lang.Object[] arguments)
|
void |
error(java.lang.String messageFormat,
java.lang.Object argument1,
java.lang.Object argument2)
|
void |
error(java.lang.String message,
java.lang.Throwable exception)
|
java.lang.String |
getName()
|
void |
info(java.lang.String message)
|
void |
info(java.lang.String messageFormat,
java.lang.Object argument)
|
void |
info(java.lang.String messageFormat,
java.lang.Object[] arguments)
|
void |
info(java.lang.String messageFormat,
java.lang.Object argument1,
java.lang.Object argument2)
|
void |
info(java.lang.String message,
java.lang.Throwable exception)
|
boolean |
isDebugEnabled()
|
boolean |
isErrorEnabled()
|
boolean |
isInfoEnabled()
|
boolean |
isWarnEnabled()
|
void |
warn(java.lang.String message)
|
void |
warn(java.lang.String messageFormat,
java.lang.Object argument)
|
void |
warn(java.lang.String messageFormat,
java.lang.Object[] arguments)
|
void |
warn(java.lang.String messageFormat,
java.lang.Object argument1,
java.lang.Object argument2)
|
void |
warn(java.lang.String message,
java.lang.Throwable exception)
|
| Methods inherited from class org.slf4j.impl.MarkerIgnoringBase |
|---|
debug, debug, debug, debug, debug, error, error, error, error, error, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isWarnEnabled, warn, warn, warn, warn, warn |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public java.lang.String getName()
public boolean isErrorEnabled()
public boolean isWarnEnabled()
public boolean isInfoEnabled()
public boolean isDebugEnabled()
public void error(java.lang.String message)
public void error(java.lang.String messageFormat,
java.lang.Object argument)
public void error(java.lang.String messageFormat,
java.lang.Object argument1,
java.lang.Object argument2)
public void error(java.lang.String messageFormat,
java.lang.Object[] arguments)
public void error(java.lang.String message,
java.lang.Throwable exception)
public void warn(java.lang.String message)
public void warn(java.lang.String messageFormat,
java.lang.Object argument)
public void warn(java.lang.String messageFormat,
java.lang.Object argument1,
java.lang.Object argument2)
public void warn(java.lang.String messageFormat,
java.lang.Object[] arguments)
public void warn(java.lang.String message,
java.lang.Throwable exception)
public void info(java.lang.String message)
public void info(java.lang.String messageFormat,
java.lang.Object argument)
public void info(java.lang.String messageFormat,
java.lang.Object argument1,
java.lang.Object argument2)
public void info(java.lang.String messageFormat,
java.lang.Object[] arguments)
public void info(java.lang.String message,
java.lang.Throwable exception)
public void debug(java.lang.String message)
public void debug(java.lang.String messageFormat,
java.lang.Object argument)
public void debug(java.lang.String messageFormat,
java.lang.Object argument1,
java.lang.Object argument2)
public void debug(java.lang.String messageFormat,
java.lang.Object[] arguments)
public void debug(java.lang.String message,
java.lang.Throwable exception)
|
Copyright (c) 2004-2006, Graham Lea. All rights reserved. |
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||