Package simpleorm.utils
Class SLogSlf4j
- java.lang.Object
-
- simpleorm.utils.SLog
-
- simpleorm.utils.SLogSlf4j
-
- Direct Known Subclasses:
SormLog
public class SLogSlf4j extends SLog
An implementation of SLog to allow Simpleorm to log via Slf4j. Log level is then controlled by slf4j, not by SLog.slog.level.Mapping between SLog and slf4j log levels is:
SLog Slf4j - Marker ---------------- -------------------- debug (30) debug warn warn message warn error error connections (10) info updates (20) debug SORM_UPDATE queries (30) debug SORM_QUERY fields (40) trace SORM_FIELD
To use this logging API, you must: 1) SLog.setSlogClass(SLogSlf4j.class); somewhere early in you app (in you servlet init sequence for example) 2) make sure you have a slf4j implementation in your classpath (logback, simplelogger, etc.)
Configure slf4j, for examples, @see http://www.slf4j.org/
-
-
Field Summary
Fields Modifier and Type Field Description int
level
-
Constructor Summary
Constructors Constructor Description SLogSlf4j()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
arrayToString(java.lang.Object[] array)
void
connections(java.lang.String msg)
void
debug(java.lang.String msg)
boolean
enableDebug()
For detailed temporary traces during development only.boolean
enableFields()
set/get per field.boolean
enableQueries()
boolean
enableUpdates()
void
error(java.lang.String msg)
void
fields(java.lang.String msg)
void
message(java.lang.String msg)
For messages that are the output, eg.void
queries(java.lang.String msg)
void
updates(java.lang.String msg)
void
warn(java.lang.String msg)
-
Methods inherited from class simpleorm.utils.SLog
getLevel, getSession, getSessionlessLogger, getSlogClass, getStream, log, newSLog, sessionToString, setLevel, setSession, setSlogClass
-
-
-
-
Method Detail
-
connections
public void connections(java.lang.String msg)
- Overrides:
connections
in classSLog
-
enableUpdates
public boolean enableUpdates()
- Overrides:
enableUpdates
in classSLog
-
enableQueries
public boolean enableQueries()
- Overrides:
enableQueries
in classSLog
-
enableFields
public boolean enableFields()
set/get per field. enableFields enables the trace line to be surounded by an if test which is important as fields are an inner loop trace and the StringBuffer concatenation can be very expensive!- Overrides:
enableFields
in classSLog
-
enableDebug
public boolean enableDebug()
For detailed temporary traces during development only.- Overrides:
enableDebug
in classSLog
-
message
public void message(java.lang.String msg)
For messages that are the output, eg. of unit test programs. Never disabled.
-
arrayToString
public static java.lang.String arrayToString(java.lang.Object[] array)
-
-