|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.toplink.logging.AbstractSessionLog org.springframework.orm.toplink.support.CommonsLoggingSessionLog
public class CommonsLoggingSessionLog
TopLink 10.1.3+ SessionLog implementation that logs through Commons Logging.
The namespace used is "oracle.toplink.xxx", with the latter part being the TopLink log category ("sql"/"transaction"/etc). In case of no category given, "session" will be used as default. This allows for fine-grained filtering of log messages, for example through Log4J configuration.
Maps TopLink's SEVERE level to CL ERROR, TopLink's WARNING to CL WARN, TopLink's INFO to CL INFO, TopLink's CONFIG/FINE/FINER to CL DEBUG, and TopLink's FINEST to CL TRACE. This results in common CL log behavior: INFO logging only at startup; operation logging at DEBUG level. Debug logging can be further filtered according to categories: for example, activate Log4J DEBUG logging for category "oracle.toplink.sql" to see the generated SQL.
Note: This implementation will only work on TopLink 10.1.3 or higher,
as it is built against TopLink's new SessionLog facilities in the
oracle.toplink.logging
package, supporting log categories.
CommonsLoggingSessionLog904
,
oracle.toplink.logging.JavaLog
,
LocalSessionFactory.setSessionLog(oracle.toplink.sessions.SessionLog)
Field Summary | |
---|---|
static String |
DEFAULT_NAMESPACE
|
static String |
DEFAULT_SEPARATOR
|
static String |
NAMESPACE_PREFIX
|
Fields inherited from class oracle.toplink.logging.AbstractSessionLog |
---|
CONFIG_PREFIX, CONNECTION_STRING, dateFormat, defaultLog, FINE_PREFIX, FINER_PREFIX, FINEST_PREFIX, INFO_PREFIX, level, session, sessionHashCode, sessionType, SEVERE_PREFIX, shouldLogExceptionStackTrace, shouldPrintDate, shouldPrintSession, shouldPrintThread, THREAD_STRING, TOPLINK_PREFIX, WARNING_PREFIX, writer |
Fields inherited from interface oracle.toplink.sessions.SessionLog |
---|
ALL, CONFIG, FINE, FINER, FINEST, INFO, OFF, SEVERE, WARNING |
Constructor Summary | |
---|---|
CommonsLoggingSessionLog()
|
Method Summary | |
---|---|
protected String |
getCategory(oracle.toplink.logging.SessionLogEntry entry)
Determine the log category for the given log entry. |
protected Throwable |
getException(oracle.toplink.logging.SessionLogEntry entry)
Extract the exception from the given log entry. |
protected String |
getMessageString(oracle.toplink.logging.SessionLogEntry entry)
Build the message String for the given log entry, including the supplemental details (session, connection) and the formatted message. |
String |
getSeparator()
Return the separator between TopLink's supplemental details (session, connection) and the log message itself. |
protected oracle.toplink.publicinterface.Session |
getSession(oracle.toplink.logging.SessionLogEntry entry)
Extract the exception from the given log entry. |
void |
log(oracle.toplink.logging.SessionLogEntry entry)
|
void |
setSeparator(String separator)
Specify the separator between TopLink's supplemental details (session, connection) and the log message itself. |
Methods inherited from class oracle.toplink.logging.AbstractSessionLog |
---|
buildDefaultDateFormat, buildSessionHashCode, buildSessionType, clone, config, fine, finer, finest, formatMessage, getConnectionString, getDateFormat, getDateString, getLevel, getLevel, getLog, getSession, getSessionString, getSessionString, getSupplementDetailString, getThreadString, getWriter, info, isOff, log, log, log, log, log, log, log, logThrowable, printPrefixString, setDateFormat, setLevel, setLevel, setLog, setSession, setShouldLogDebug, setShouldLogExceptions, setShouldLogExceptionStackTrace, setShouldPrintConnection, setShouldPrintDate, setShouldPrintSession, setShouldPrintThread, setWriter, severe, shouldLog, shouldLog, shouldLogDebug, shouldLogExceptions, shouldLogExceptionStackTrace, shouldPrintConnection, shouldPrintDate, shouldPrintSession, shouldPrintThread, throwing, warning |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NAMESPACE_PREFIX
public static final String DEFAULT_NAMESPACE
public static final String DEFAULT_SEPARATOR
Constructor Detail |
---|
public CommonsLoggingSessionLog()
Method Detail |
---|
public void setSeparator(String separator)
public String getSeparator()
public void log(oracle.toplink.logging.SessionLogEntry entry)
log
in class oracle.toplink.logging.AbstractSessionLog
protected String getCategory(oracle.toplink.logging.SessionLogEntry entry)
If the entry carries a name space value, it will be appended to the "oracle.toplink." prefix; else, "oracle.toplink.session" will be used.
protected String getMessageString(oracle.toplink.logging.SessionLogEntry entry)
AbstractSessionLog.getSessionString(oracle.toplink.sessions.Session)
,
AbstractSessionLog.getConnectionString(oracle.toplink.internal.databaseaccess.Accessor)
,
AbstractSessionLog.formatMessage(oracle.toplink.logging.SessionLogEntry)
,
getSeparator()
protected oracle.toplink.publicinterface.Session getSession(oracle.toplink.logging.SessionLogEntry entry)
The default implementation calls SessionLogEntry.getSession
via reflection: The return type varies between TopLink 10.1.3 and 11
(Session
vs AbstractSession
, respectively).
protected Throwable getException(oracle.toplink.logging.SessionLogEntry entry)
The default implementation calls SessionLogEntry.getException
via reflection: The return type varies between TopLink 9.0.4 and 10.1.3
(Exception
vs Throwable
, respectively).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |