Class AbstractSessionLog
- All Implemented Interfaces:
Cloneable
,SessionLog
- Direct Known Subclasses:
DefaultSessionLog
,JavaLog
,ServerLog
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static String
Represents prefix to logged configprotected static final String
Connection stringprotected static String
protected DateFormat
Format use to print the current date/time.protected static SessionLog
Represents the singleton SessionLogprotected static String
Represents prefix to logged fineprotected static String
Represents prefix to logged finerprotected static String
Represents prefix to logged finestprotected static String
Represents prefix to logged infoprotected int
Represents the log levelprotected Session
Represents the session that owns this SessionLogprotected static String
Represents prefix to logged severeprotected Boolean
Used to determine if bingdparameters should be logged or hidden.protected Boolean
Allows the printing of the stack to be explicitly disabled/enabled.protected Boolean
Allows the printing of the connection to be explicitly disabled/enabled.protected Boolean
Allows the printing of the date to be explicitly disabled/enabled.protected Boolean
Allows the printing of the session to be explicitly disabled/enabled.protected Boolean
Allows the printing of the thread to be explicitly disabled/enabled.protected static final String
Thread stringprotected static String
Cached TopLink prefix string.protected static String
Represents prefix to logged warningprotected Writer
Represents the writer that will receive the formatted log entriesFields inherited from interface org.eclipse.persistence.logging.SessionLog
ALL, ALL_LABEL, CACHE, CONFIG, CONFIG_LABEL, CONNECTION, DBWS, DDL, DMS, EJB, EVENT, FINE, FINE_LABEL, FINER, FINER_LABEL, FINEST, FINEST_LABEL, INFO, INFO_LABEL, JPA, JPARS, loggerCatagories, METADATA, METAMODEL, MISC, MONITORING, MOXY, OFF, OFF_LABEL, PROCESSOR, PROPAGATION, PROPERTIES, QUERY, SEQUENCING, SERVER, SEVERE, SEVERE_LABEL, SQL, THREAD, TRANSACTION, WARNING, WARNING_LABEL, WEAVER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
INTERNAL: Each session owns its own session log because session is stored in the session logvoid
PUBLIC:void
PUBLIC:void
PUBLIC:void
PUBLIC:protected String
formatMessage
(SessionLogEntry entry) Return the formatted message based on the information from the given SessionLogEntry.protected String
getConnectionString
(org.eclipse.persistence.internal.databaseaccess.Accessor connection) Return the specified connection information.PUBLIC: Return the date format to be used when printing a log entry date.protected String
getDateString
(Date date) Return the specified date and/or time information in string.static int
Return the system default log level.int
getLevel()
PUBLIC:int
PUBLIC:PUBLIC:static SessionLog
getLog()
PUBLIC:PUBLIC:protected String
getSessionString
(Session session) Return the current session including the type and id.protected String
Return the supplement detail information including date, session, thread, connection, source class name and source method name.protected String
getThreadString
(Thread thread) Return the specified thread information.PUBLIC:void
PUBLIC:boolean
isOff()
INTERNAL: Check if the log level is set to off.void
PUBLIC:void
PUBLIC:void
PUBLIC:void
PUBLIC:void
PUBLIC:void
PUBLIC:void
PUBLIC:void
PUBLIC:void
PUBLIC:void
PUBLIC:void
PUBLIC:void
PUBLIC:void
log
(int level, String category, String message, Object param1, Object param2, Object param3, Object param4) PUBLIC:abstract void
log
(SessionLogEntry sessionLogEntry) PUBLIC:void
logThrowable
(int level, String category, Throwable throwable) PUBLIC:void
logThrowable
(int level, Throwable throwable) PUBLIC:protected void
printPrefixString
(int level, String category) Print the prefix string representing EclipseLink loggingvoid
setDateFormat
(DateFormat dateFormat) PUBLIC: Set the date format to be used when printing a log entry date.void
setLevel
(int level) PUBLIC:void
PUBLIC:static void
setLog
(SessionLog sessionLog) PUBLIC:void
setSession
(Session session) PUBLIC:void
setShouldDisplayData
(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
(OutputStream outputstream) PUBLIC:void
PUBLIC:void
PUBLIC:boolean
PUBLIC: Return true if SQL logging should log visible bind parameters.boolean
shouldLog
(int level) PUBLIC:boolean
PUBLIC:boolean
By default the stack is logged for FINER or less (finest).boolean
By default the connection is printed, this can be turned off.boolean
By default the date is always printed, but can be turned off.boolean
By default the session (and its connection is available) are printed, this can be turned off.boolean
By default the thread is logged for FINE or less (finer,etc.).void
PUBLIC:static String
translateLoggingLevelToString
(int loggingLevel) INTERNAL: Translate the string value of the log level to the constant value.static int
translateStringToLoggingLevel
(String loggingLevel) INTERNAL: Translate the string value of the log level to the constant value.void
PUBLIC:
-
Field Details
-
level
protected int levelRepresents the log level -
defaultLog
Represents the singleton SessionLog -
session
Represents the session that owns this SessionLog -
SEVERE_PREFIX
Represents prefix to logged severe -
WARNING_PREFIX
Represents prefix to logged warning -
INFO_PREFIX
Represents prefix to logged info -
CONFIG_PREFIX
Represents prefix to logged config -
FINE_PREFIX
Represents prefix to logged fine -
FINER_PREFIX
Represents prefix to logged finer -
FINEST_PREFIX
Represents prefix to logged finest -
TOPLINK_PREFIX
Cached TopLink prefix string. -
CONNECTION_STRING
Connection string- See Also:
-
THREAD_STRING
Thread string- See Also:
-
writer
Represents the writer that will receive the formatted log entries -
DATE_FORMAT_STR
-
dateFormat
Format use to print the current date/time. -
shouldLogExceptionStackTrace
Allows the printing of the stack to be explicitly disabled/enabled. CR #3870467. null value is default behavior of determining from log level. -
shouldPrintDate
Allows the printing of the date to be explicitly disabled/enabled. CR #3870467. null value is default behavior of determining from log level. -
shouldPrintThread
Allows the printing of the thread to be explicitly disabled/enabled. CR #3870467. null value is default behavior of determining from log level. -
shouldPrintSession
Allows the printing of the session to be explicitly disabled/enabled. CR #3870467. null value is default behavior of determining from log level. -
shouldPrintConnection
Allows the printing of the connection to be explicitly disabled/enabled. CR #4157545. null value is default behavior of determining from log level. -
shouldDisplayData
Used to determine if bingdparameters should be logged or hidden.
-
-
Constructor Details
-
AbstractSessionLog
public AbstractSessionLog()PUBLIC: Create a new AbstractSessionLog
-
-
Method Details
-
getDefaultLoggingLevel
public static int getDefaultLoggingLevel()Return the system default log level. This is based on the System property "eclipselink.logging.level", or INFO if not set. -
getLevel
public int getLevel()PUBLIC:Return the log level. It is used when session is not available.
- Specified by:
getLevel
in interfaceSessionLog
- Returns:
- the log level
-
getLevelString
PUBLIC:Return the log level as a string value.
- Specified by:
getLevelString
in interfaceSessionLog
-
getLevel
PUBLIC:Return the log level for the category name space.
- Specified by:
getLevel
in interfaceSessionLog
- Parameters:
category
- the string representation of a EclipseLink category, e.g. "sql", "transaction" ...- Returns:
- the log level
-
setLevel
public void setLevel(int level) PUBLIC:Set the log level. It is used when session is not available.
- Specified by:
setLevel
in interfaceSessionLog
- Parameters:
level
- the new log level
-
setLevel
PUBLIC:Set the log level for the category name space.
- Specified by:
setLevel
in interfaceSessionLog
- Parameters:
level
- the new log levelcategory
- the string representation of an EclipseLink category, e.g. "sql", "transaction" ...
-
shouldDisplayData
public boolean shouldDisplayData()PUBLIC: Return true if SQL logging should log visible bind parameters. If the shouldDisplayData is not set, check the session log level and return true for a level greater than CONFIG.- Specified by:
shouldDisplayData
in interfaceSessionLog
-
shouldLog
public boolean shouldLog(int level) PUBLIC:Check if a message of the given level would actually be logged. It is used when session is not available.
- Specified by:
shouldLog
in interfaceSessionLog
- Parameters:
level
- the log request level- Returns:
- true if the given message level will be logged
-
shouldLog
PUBLIC: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.
- Specified by:
shouldLog
in interfaceSessionLog
- Parameters:
level
- the log request levelcategory
- the string representation of an EclipseLink category, e.g. "sql", "transaction" ...*- Returns:
- true if the given message level will be logged
-
getLog
PUBLIC: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.
- Returns:
- the singleton SessionLog
-
setLog
PUBLIC:Set the singleton SessionLog.
- Parameters:
sessionLog
- a SessionLog
-
getSession
PUBLIC:Get the session.
- Specified by:
getSession
in interfaceSessionLog
- Returns:
- session
-
setSession
PUBLIC:Set the session.
- Specified by:
setSession
in interfaceSessionLog
- Parameters:
session
- a Session
-
log
PUBLIC: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.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- the log request level valuemessage
- the string message - this should not be a bundle key
-
log
PUBLIC:Log a message with one parameter that needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- the log request level valuemessage
- the string messageparam
- a parameter of the message
-
log
PUBLIC:Log a message with one parameter that needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- the log request level valuemessage
- the string messageparam
- a parameter of the message
-
log
PUBLIC:Log a message with two parameters that needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- the log request level valuemessage
- the string messageparam1
- a parameter of the messageparam2
- second parameter of the message
-
log
PUBLIC:Log a message with two parameters that needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- the log request level valuemessage
- the string messageparam1
- a parameter of the messageparam2
- second parameter of the message
-
log
PUBLIC:Log a message with three parameters that needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- the log request level valuemessage
- the string messageparam1
- a parameter of the messageparam2
- second parameter of the messageparam3
- third parameter of the message
-
log
public void log(int level, String category, String message, Object param1, Object param2, Object param3) PUBLIC:Log a message with three parameters that needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- the log request level valuemessage
- the string messageparam1
- a parameter of the messageparam2
- second parameter of the messageparam3
- third parameter of the message
-
log
public void log(int level, String message, Object param1, Object param2, Object param3, Object param4) PUBLIC:Log a message with four parameters that needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- 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
-
log
public void log(int level, String category, String message, Object param1, Object param2, Object param3, Object param4) PUBLIC:Log a message with four parameters that needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- 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
-
log
PUBLIC:Log a message with an array of parameters that needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- the log request level valuemessage
- the string messageparams
- array of parameters to the message
-
log
PUBLIC:Log a message with an array of parameters that needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- the log request level valuemessage
- the string messageparams
- array of parameters to the message
-
log
PUBLIC:Log a message. shouldTranslate determines if the message needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- the log request levelmessage
- the string messageparams
- array of parameters to the messageshouldTranslate
- true if the message needs to be translated
-
log
public void log(int level, String category, String message, Object[] params, boolean shouldTranslate) PUBLIC:Log a message. shouldTranslate determines if the message needs to be translated.
- Specified by:
log
in interfaceSessionLog
- Parameters:
level
- the log request levelmessage
- the string messagecategory
- the log categoryparams
- array of parameters to the messageshouldTranslate
- true if the message needs to be translated
-
log
PUBLIC:Log a SessionLogEntry
- Specified by:
log
in interfaceSessionLog
- Parameters:
sessionLogEntry
- SessionLogEntry that holds all the information for an EclipseLink logging event
-
shouldPrintSession
public boolean shouldPrintSession()By default the session (and its connection is available) are printed, this can be turned off.- Specified by:
shouldPrintSession
in interfaceSessionLog
-
setShouldPrintSession
public void setShouldPrintSession(boolean shouldPrintSession) By default the session (and its connection is available) are printed, this can be turned off.- Specified by:
setShouldPrintSession
in interfaceSessionLog
-
shouldPrintConnection
public boolean shouldPrintConnection()By default the connection is printed, this can be turned off.- Specified by:
shouldPrintConnection
in interfaceSessionLog
-
setShouldPrintConnection
public void setShouldPrintConnection(boolean shouldPrintConnection) By default the connection is printed, this can be turned off.- Specified by:
setShouldPrintConnection
in interfaceSessionLog
-
shouldLogExceptionStackTrace
public boolean shouldLogExceptionStackTrace()By default the stack is logged for FINER or less (finest). The logging of the stack can also be explicitly turned on or off.- Specified by:
shouldLogExceptionStackTrace
in interfaceSessionLog
-
setShouldDisplayData
PUBLIC: Set whether bind parameters should be displayed when logging SQL.- Specified by:
setShouldDisplayData
in interfaceSessionLog
-
setShouldLogExceptionStackTrace
public void setShouldLogExceptionStackTrace(boolean shouldLogExceptionStackTrace) By default the stack is logged for FINER or less (finest). The logging of the stack can also be explicitly turned on or off.- Specified by:
setShouldLogExceptionStackTrace
in interfaceSessionLog
-
shouldPrintDate
public boolean shouldPrintDate()By default the date is always printed, but can be turned off.- Specified by:
shouldPrintDate
in interfaceSessionLog
-
setShouldPrintDate
public void setShouldPrintDate(boolean shouldPrintDate) By default the date is always printed, but can be turned off.- Specified by:
setShouldPrintDate
in interfaceSessionLog
-
shouldPrintThread
public boolean shouldPrintThread()By default the thread is logged for FINE or less (finer,etc.). The logging of the thread can also be explicitly turned on or off.- Specified by:
shouldPrintThread
in interfaceSessionLog
-
setShouldPrintThread
public void setShouldPrintThread(boolean shouldPrintThread) By default the thread is logged for FINE or less (finer,etc.). The logging of the thread can also be explicitly turned on or off.- Specified by:
setShouldPrintThread
in interfaceSessionLog
-
getWriter
PUBLIC:Return the writer that will receive the formatted log entries.
- Specified by:
getWriter
in interfaceSessionLog
- Returns:
- the log writer
-
setWriter
PUBLIC:Set the writer that will receive the formatted log entries.
- Specified by:
setWriter
in interfaceSessionLog
- Parameters:
writer
- the log writer
-
setWriter
PUBLIC:Set the writer that will receive the formatted log entries.
- Parameters:
outputstream
- the log writer
-
getDateFormat
PUBLIC: Return the date format to be used when printing a log entry date.- Returns:
- the date format
-
getDateString
Return the specified date and/or time information in string. The format will be determined by the date format settings. -
getSupplementDetailString
Return the supplement detail information including date, session, thread, connection, source class name and source method name. -
getSessionString
Return the current session including the type and id. -
getConnectionString
protected String getConnectionString(org.eclipse.persistence.internal.databaseaccess.Accessor connection) Return the specified connection information. -
getThreadString
Return the specified thread information. -
printPrefixString
Print the prefix string representing EclipseLink logging -
setDateFormat
PUBLIC: Set the date format to be used when printing a log entry date.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.- Parameters:
dateFormat
- java.text.DateFormat
-
formatMessage
Return the formatted message based on the information from the given SessionLogEntry. The message will either be translated and formatted or formatted only depending on if the shouldTranslate flag is set to true of false. -
translateStringToLoggingLevel
INTERNAL: Translate the string value of the log level to the constant value. If value is null or invalid use the default. -
throwing
PUBLIC:Log a throwable at FINER level.
- Specified by:
throwing
in interfaceSessionLog
- Parameters:
throwable
- a Throwable
-
severe
PUBLIC:This method is called when a severe level message needs to be logged. The message will be translated
- Specified by:
severe
in interfaceSessionLog
- Parameters:
message
- the message key
-
warning
PUBLIC:This method is called when a warning level message needs to be logged. The message will be translated
- Specified by:
warning
in interfaceSessionLog
- Parameters:
message
- the message key
-
info
PUBLIC:This method is called when a info level message needs to be logged. The message will be translated
- Specified by:
info
in interfaceSessionLog
- Parameters:
message
- the message key
-
config
PUBLIC:This method is called when a config level message needs to be logged. The message will be translated
- Specified by:
config
in interfaceSessionLog
- Parameters:
message
- the message key
-
fine
PUBLIC:This method is called when a fine level message needs to be logged. The message will be translated
- Specified by:
fine
in interfaceSessionLog
- Parameters:
message
- the message key
-
finer
PUBLIC:This method is called when a finer level message needs to be logged. The message will be translated
- Specified by:
finer
in interfaceSessionLog
- Parameters:
message
- the message key
-
finest
PUBLIC:This method is called when a finest level message needs to be logged. The message will be translated
- Specified by:
finest
in interfaceSessionLog
- Parameters:
message
- the message key
-
logThrowable
PUBLIC:Log a throwable with level.
- Specified by:
logThrowable
in interfaceSessionLog
- Parameters:
level
- the log request level valuethrowable
- a Throwable
-
logThrowable
PUBLIC:Log a throwable with level.
- Specified by:
logThrowable
in interfaceSessionLog
- Parameters:
level
- the log request level valuethrowable
- a Throwable
-
isOff
public boolean isOff()INTERNAL: Check if the log level is set to off. -
clone
INTERNAL: Each session owns its own session log because session is stored in the session log- Specified by:
clone
in interfaceSessionLog
- Overrides:
clone
in classObject
-
translateLoggingLevelToString
INTERNAL: Translate the string value of the log level to the constant value. If value is null or invalid use the default.
-