public abstract class AbstractSessionLog extends java.lang.Object implements SessionLog, java.lang.Cloneable
SessionLog, SessionLogEntry, DefaultSessionLog, JavaLogALL, ALL_LABEL, CACHE, CONFIG, CONFIG_LABEL, CONNECTION, DDL, DMS, EJB, EJB_OR_METADATA, EVENT, FINE, FINE_LABEL, FINER, FINER_LABEL, FINEST, FINEST_LABEL, INFO, INFO_LABEL, JPA, JPARS, loggerCatagories, METADATA, METAMODEL, MONITORING, OFF, OFF_LABEL, PROPAGATION, PROPERTIES, QUERY, SEQUENCING, SERVER, SEVERE, SEVERE_LABEL, SQL, TRANSACTION, WARNING, WARNING_LABEL, WEAVER| Constructor and Description |
|---|
AbstractSessionLog()
PUBLIC: Create a new AbstractSessionLog
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
INTERNAL: Each session owns its own session log because session is stored in the session log
|
void |
config(java.lang.String message)
PUBLIC: This method is called when a config level message needs to be logged.
|
void |
fine(java.lang.String message)
PUBLIC: This method is called when a fine level message needs to be logged.
|
void |
finer(java.lang.String message)
PUBLIC: This method is called when a finer level message needs to be logged.
|
void |
finest(java.lang.String message)
PUBLIC: This method is called when a finest level message needs to be logged.
|
java.text.DateFormat |
getDateFormat()
PUBLIC: Return the date format to be used when printing a log entry date.
|
static int |
getDefaultLoggingLevel()
Return the system default log level.
|
int |
getLevel()
PUBLIC: Return the log level.
|
int |
getLevel(java.lang.String category)
PUBLIC: Return the log level for the category name space.
|
java.lang.String |
getLevelString()
PUBLIC: Return the log level as a string value.
|
static SessionLog |
getLog()
PUBLIC: Return the singleton SessionLog.
|
Session |
getSession()
PUBLIC: Get the session.
|
java.io.Writer |
getWriter()
PUBLIC: Return the writer that will receive the formatted log entries.
|
void |
info(java.lang.String message)
PUBLIC: This method is called when a info level message needs to be logged.
|
boolean |
isOff()
INTERNAL: Check if the log level is set to off.
|
void |
log(int level, java.lang.String message)
PUBLIC: Log a message that does not need to be translated.
|
void |
log(int level, java.lang.String message, java.lang.Object param)
PUBLIC: Log a message with one parameter that needs to be translated.
|
void |
log(int level, java.lang.String message, java.lang.Object[] params)
PUBLIC: Log a message with an array of parameters that needs to be translated.
|
void |
log(int level, java.lang.String message, java.lang.Object[] params, boolean shouldTranslate)
PUBLIC: Log a message.
|
void |
log(int level, java.lang.String message, java.lang.Object param1, java.lang.Object param2)
PUBLIC: Log a message with two parameters that needs to be translated.
|
void |
log(int level, java.lang.String message, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3)
PUBLIC: Log a message with three parameters that needs to be translated.
|
void |
log(int level, java.lang.String message, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3, java.lang.Object param4)
PUBLIC: Log a message with four parameters that needs to be translated.
|
void |
log(int level, java.lang.String category, java.lang.String message, java.lang.Object param)
PUBLIC: Log a message with one parameter that needs to be translated.
|
void |
log(int level, java.lang.String category, java.lang.String message, java.lang.Object[] params)
PUBLIC: Log a message with an array of parameters that needs to be translated.
|
void |
log(int level, java.lang.String category, java.lang.String message, java.lang.Object[] params, boolean shouldTranslate)
PUBLIC: Log a message.
|
void |
log(int level, java.lang.String category, java.lang.String message, java.lang.Object param1, java.lang.Object param2)
PUBLIC: Log a message with two parameters that needs to be translated.
|
void |
log(int level, java.lang.String category, java.lang.String message, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3)
PUBLIC: Log a message with three parameters that needs to be translated.
|
void |
log(int level, java.lang.String category, java.lang.String message, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3, java.lang.Object param4)
PUBLIC: Log a message with four parameters that needs to be translated.
|
abstract void |
log(SessionLogEntry sessionLogEntry)
PUBLIC: Log a SessionLogEntry
|
void |
logThrowable(int level, java.lang.String category, java.lang.Throwable throwable)
PUBLIC: Log a throwable with level.
|
void |
logThrowable(int level, java.lang.Throwable throwable)
PUBLIC: Log a throwable with level.
|
void |
setDateFormat(java.text.DateFormat dateFormat)
PUBLIC: Set the date format to be used when printing a log entry date.
|
void |
setLevel(int level)
PUBLIC: Set the log level.
|
void |
setLevel(int level, java.lang.String category)
PUBLIC: Set the log level for the category name space.
|
static void |
setLog(SessionLog sessionLog)
PUBLIC: Set the singleton SessionLog.
|
void |
setSession(Session session)
PUBLIC: Set the session.
|
void |
setShouldDisplayData(java.lang.Boolean shouldDisplayData)
PUBLIC: Set whether bind parameters should be displayed when logging SQL.
|
void |
setShouldLogExceptionStackTrace(boolean shouldLogExceptionStackTrace)
By default the stack is logged for FINER or less (finest).
|
void |
setShouldPrintConnection(boolean shouldPrintConnection)
By default the connection is printed, this can be turned off.
|
void |
setShouldPrintDate(boolean shouldPrintDate)
By default the date is always printed, but can be turned off.
|
void |
setShouldPrintSession(boolean shouldPrintSession)
By default the session (and its connection is available) are printed, this can be turned off.
|
void |
setShouldPrintThread(boolean shouldPrintThread)
By default the thread is logged for FINE or less (finer,etc.).
|
void |
setWriter(java.io.OutputStream outputstream)
PUBLIC: Set the writer that will receive the formatted log entries.
|
void |
setWriter(java.io.Writer writer)
PUBLIC: Set the writer that will receive the formatted log entries.
|
void |
severe(java.lang.String message)
PUBLIC: This method is called when a severe level message needs to be logged.
|
boolean |
shouldDisplayData()
PUBLIC: Return true if SQL logging should log visible bind parameters.
|
boolean |
shouldLog(int level)
PUBLIC: Check if a message of the given level would actually be logged.
|
boolean |
shouldLog(int level, java.lang.String category)
PUBLIC: Check if a message of the given level would actually be logged for the category name space. !
|
boolean |
shouldLogExceptionStackTrace()
By default the stack is logged for FINER or less (finest).
|
boolean |
shouldPrintConnection()
By default the connection is printed, this can be turned off.
|
boolean |
shouldPrintDate()
By default the date is always printed, but can be turned off.
|
boolean |
shouldPrintSession()
By default the session (and its connection is available) are printed, this can be turned off.
|
boolean |
shouldPrintThread()
By default the thread is logged for FINE or less (finer,etc.).
|
void |
throwing(java.lang.Throwable throwable)
PUBLIC: Log a throwable at FINER level.
|
static java.lang.String |
translateLoggingLevelToString(int loggingLevel)
INTERNAL: Translate the string value of the log level to the constant value.
|
static int |
translateStringToLoggingLevel(java.lang.String loggingLevel)
INTERNAL: Translate the string value of the log level to the constant value.
|
void |
warning(java.lang.String message)
PUBLIC: This method is called when a warning level message needs to be logged.
|
public AbstractSessionLog()
public static int getDefaultLoggingLevel()
public int getLevel()
Return the log level. It is used when session is not available.
getLevel in interface SessionLogpublic java.lang.String getLevelString()
Return the log level as a string value.
getLevelString in interface SessionLogpublic int getLevel(java.lang.String category)
Return the log level for the category name space.
getLevel in interface SessionLogcategory - the string representation of a EclipseLink category, e.g. "sql", "transaction" ...public void setLevel(int level)
Set the log level. It is used when session is not available.
setLevel in interface SessionLoglevel - the new log level
public void setLevel(int level,
java.lang.String category)
Set the log level for the category name space.
setLevel in interface SessionLoglevel - the new log levelcategory - the string representation of an EclipseLink category, e.g. "sql", "transaction" ...public boolean shouldDisplayData()
shouldDisplayData in interface SessionLogpublic boolean shouldLog(int level)
Check if a message of the given level would actually be logged. It is used when session is not available.
shouldLog in interface SessionLoglevel - the log request level
public boolean shouldLog(int level,
java.lang.String category)
Check if a message of the given level would actually be logged for the category name space. !isOff() is checked to screen out the possibility when both log level and log request level are set to OFF.
shouldLog in interface SessionLoglevel - the log request levelcategory - the string representation of an EclipseLink category, e.g. "sql", "transaction" ...*public static SessionLog getLog()
Return the singleton SessionLog. If the singleton SessionLog does not exist, a new one is created based on the version of JDK being used from the Version class.
public static void setLog(SessionLog sessionLog)
Set the singleton SessionLog.
sessionLog - a SessionLogpublic Session getSession()
Get the session.
getSession in interface SessionLogpublic void setSession(Session session)
Set the session.
setSession in interface SessionLogsession - a Session
public void log(int level,
java.lang.String message)
Log a message that does not need to be translated. This method is intended for external use when logging messages are required within the EclipseLink output.
log in interface SessionLoglevel - the log request level valuemessage - the string message - this should not be a bundle key
public void log(int level,
java.lang.String message,
java.lang.Object param)
Log a message with one parameter that needs to be translated.
log in interface SessionLoglevel - the log request level valuemessage - the string messageparam - a parameter of the message
public void log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object param)
Log a message with one parameter that needs to be translated.
log in interface SessionLoglevel - the log request level valuemessage - the string messageparam - a parameter of the message
public void log(int level,
java.lang.String message,
java.lang.Object param1,
java.lang.Object param2)
Log a message with two parameters that needs to be translated.
log in interface SessionLoglevel - the log request level valuemessage - the string messageparam1 - a parameter of the messageparam2 - second parameter of the message
public void log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object param1,
java.lang.Object param2)
Log a message with two parameters that needs to be translated.
log in interface SessionLoglevel - the log request level valuemessage - the string messageparam1 - a parameter of the messageparam2 - second parameter of the message
public void log(int level,
java.lang.String message,
java.lang.Object param1,
java.lang.Object param2,
java.lang.Object param3)
Log a message with three parameters that needs to be translated.
log in interface SessionLoglevel - the log request level valuemessage - the string messageparam1 - a parameter of the messageparam2 - second parameter of the messageparam3 - third parameter of the message
public void log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object param1,
java.lang.Object param2,
java.lang.Object param3)
Log a message with three parameters that needs to be translated.
log in interface SessionLoglevel - the log request level valuemessage - the string messageparam1 - a parameter of the messageparam2 - second parameter of the messageparam3 - third parameter of the message
public void log(int level,
java.lang.String message,
java.lang.Object param1,
java.lang.Object param2,
java.lang.Object param3,
java.lang.Object param4)
Log a message with four parameters that needs to be translated.
log in interface SessionLoglevel - the log request level valuemessage - the string messageparam1 - a parameter of the messageparam2 - second parameter of the messageparam3 - third parameter of the messageparam4 - third parameter of the message
public void log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object param1,
java.lang.Object param2,
java.lang.Object param3,
java.lang.Object param4)
Log a message with four parameters that needs to be translated.
log in interface SessionLoglevel - the log request level valuemessage - the string messageparam1 - a parameter of the messageparam2 - second parameter of the messageparam3 - third parameter of the messageparam4 - third parameter of the message
public void log(int level,
java.lang.String message,
java.lang.Object[] params)
Log a message with an array of parameters that needs to be translated.
log in interface SessionLoglevel - the log request level valuemessage - the string messageparams - array of parameters to the message
public void log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object[] params)
Log a message with an array of parameters that needs to be translated.
log in interface SessionLoglevel - the log request level valuemessage - the string messageparams - array of parameters to the message
public void log(int level,
java.lang.String message,
java.lang.Object[] params,
boolean shouldTranslate)
Log a message. shouldTranslate determines if the message needs to be translated.
log in interface SessionLoglevel - the log request levelmessage - the string messageparams - array of parameters to the messageshouldTranslate - true if the message needs to be translated
public void log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object[] params,
boolean shouldTranslate)
Log a message. shouldTranslate determines if the message needs to be translated.
log in interface SessionLoglevel - the log request levelmessage - the string messagecategory - the log categoryparams - array of parameters to the messageshouldTranslate - true if the message needs to be translatedpublic abstract void log(SessionLogEntry sessionLogEntry)
Log a SessionLogEntry
log in interface SessionLogentry - SessionLogEntry that holds all the information for an EclipseLink logging eventpublic boolean shouldPrintSession()
shouldPrintSession in interface SessionLogpublic void setShouldPrintSession(boolean shouldPrintSession)
setShouldPrintSession in interface SessionLogpublic boolean shouldPrintConnection()
shouldPrintConnection in interface SessionLogpublic void setShouldPrintConnection(boolean shouldPrintConnection)
setShouldPrintConnection in interface SessionLogpublic boolean shouldLogExceptionStackTrace()
shouldLogExceptionStackTrace in interface SessionLogpublic void setShouldDisplayData(java.lang.Boolean shouldDisplayData)
setShouldDisplayData in interface SessionLogpublic void setShouldLogExceptionStackTrace(boolean shouldLogExceptionStackTrace)
setShouldLogExceptionStackTrace in interface SessionLogpublic boolean shouldPrintDate()
shouldPrintDate in interface SessionLogpublic void setShouldPrintDate(boolean shouldPrintDate)
setShouldPrintDate in interface SessionLogpublic boolean shouldPrintThread()
shouldPrintThread in interface SessionLogpublic void setShouldPrintThread(boolean shouldPrintThread)
setShouldPrintThread in interface SessionLogpublic java.io.Writer getWriter()
Return the writer that will receive the formatted log entries.
getWriter in interface SessionLogpublic void setWriter(java.io.Writer writer)
Set the writer that will receive the formatted log entries.
setWriter in interface SessionLogwriter - the log writerpublic void setWriter(java.io.OutputStream outputstream)
Set the writer that will receive the formatted log entries.
OutputStream - the log writerpublic java.text.DateFormat getDateFormat()
public void setDateFormat(java.text.DateFormat dateFormat)
Note: the JDK's java.text.SimpleDateFormat is NOT thread-safe.
The user is strongly advised to consider using Apache Commons
org.apache.commons.lang.time.FastDateFormat instead.
dateFormat - java.text.DateFormatpublic static int translateStringToLoggingLevel(java.lang.String loggingLevel)
public void throwing(java.lang.Throwable throwable)
Log a throwable at FINER level.
throwing in interface SessionLogthrowable - a Throwablepublic void severe(java.lang.String message)
This method is called when a severe level message needs to be logged. The message will be translated
severe in interface SessionLogmessage - the message keypublic void warning(java.lang.String message)
This method is called when a warning level message needs to be logged. The message will be translated
warning in interface SessionLogmessage - the message keypublic void info(java.lang.String message)
This method is called when a info level message needs to be logged. The message will be translated
info in interface SessionLogmessage - the message keypublic void config(java.lang.String message)
This method is called when a config level message needs to be logged. The message will be translated
config in interface SessionLogmessage - the message keypublic void fine(java.lang.String message)
This method is called when a fine level message needs to be logged. The message will be translated
fine in interface SessionLogmessage - the message keypublic void finer(java.lang.String message)
This method is called when a finer level message needs to be logged. The message will be translated
finer in interface SessionLogmessage - the message keypublic void finest(java.lang.String message)
This method is called when a finest level message needs to be logged. The message will be translated
finest in interface SessionLogmessage - the message key
public void logThrowable(int level,
java.lang.Throwable throwable)
Log a throwable with level.
logThrowable in interface SessionLoglevel - the log request level valuethrowable - a Throwable
public void logThrowable(int level,
java.lang.String category,
java.lang.Throwable throwable)
Log a throwable with level.
logThrowable in interface SessionLoglevel - the log request level valuethrowable - a Throwablepublic boolean isOff()
public java.lang.Object clone()
clone in interface SessionLogclone in class java.lang.Objectpublic static java.lang.String translateLoggingLevelToString(int loggingLevel)