org.eclipse.persistence.logging
Interface SessionLog

SessionLog is the ever-so-simple interface used by
EclipseLink to log generated messages and SQL. An implementor of
this interface can be passed to the EclipseLink session
(via the #setSessionLog(SessionLog) method); and
all logging data will be passed through to the implementor
via an instance of SessionLogEntry. This can be used
to supplement debugging; or the entries could be stored
in a database instead of logged to System.out, etc.

This class defines Eclipselink logging levels (that are used throughout EclipseLink code) with the following integer values:

ALL

= 0

FINEST

= 1

FINER

= 2

FINE

= 3

CONFIG

= 4

INFO

= 5

WARNING

= 6

SEVERE

= 7

OFF

= 8

In addition, EclipseLink categories used for logging name space are defined with the following String values:

SERVER

loggerCatagories

log

PUBLIC:
TopLink will call this method whenever something
needs to be logged (messages, SQL, etc.).
All the pertinent information will be contained in
the specified entry.

Parameters:

entry - org.eclipse.persistence.sessions.LogEntry

shouldLogExceptionStackTrace

boolean shouldLogExceptionStackTrace()

By default the stack trace is logged for SEVERE all the time and at FINER level for WARNING or less,
this can be turned off.

shouldPrintDate

boolean shouldPrintDate()

By default the date is always printed, this can be turned off.

shouldPrintThread

boolean shouldPrintThread()

By default the thread is logged at FINE or less level, this can be turned off.

shouldPrintConnection

boolean shouldPrintConnection()

By default the connection is always printed whenever available, this can be turned off.

shouldPrintSession

boolean shouldPrintSession()

By default the Session is always printed whenever available, this can be turned off.

setShouldLogExceptionStackTrace

void setShouldLogExceptionStackTrace(boolean flag)

By default stack trace is logged for SEVERE all the time and at FINER level for WARNING or less.
This can be turned off.

setShouldPrintDate

void setShouldPrintDate(boolean flag)

By default date is printed, this can be turned off.

setShouldPrintThread

void setShouldPrintThread(boolean flag)

By default the thread is logged at FINE or less level, this can be turned off.

setShouldPrintConnection

void setShouldPrintConnection(boolean flag)

By default the connection is always printed whenever available, this can be turned off.

setShouldPrintSession

void setShouldPrintSession(boolean flag)

By default the Session is always printed whenever available, this can be turned off.

getWriter

java.io.Writer getWriter()

PUBLIC:
Return the writer to which an accessor writes logged messages and SQL.
If not set, this reference usually defaults to a writer on System.out.
To enable logging, logMessages must be turned on in the session.

setWriter

void setWriter(java.io.Writer log)

PUBLIC:
Set the writer to which an accessor writes logged messages and SQL.
If not set, this reference usually defaults to a writer on System.out.
To enable logging, logMessages() is used on the session.

getLevel

int getLevel()

PUBLIC:
Return the log level. Used when session is not available.

The Toplink logging levels returned correspond to:

ALL

= 0

FINEST

= 1

FINER

= 2

FINE

= 3

CONFIG

= 4

INFO

= 5

WARNING

= 6

SEVERE

= 7

OFF

= 8

getLevelString

java.lang.String getLevelString()

PUBLIC:

Return the log level as a string value.

getLevel

int getLevel(java.lang.String category)

PUBLIC:
Return the log level; category is only needed where name space
is available.

The EclipseLink logging levels returned correspond to:

ALL

= 0

FINEST

= 1

FINER

= 2

FINE

= 3

CONFIG

= 4

INFO

= 5

WARNING

= 6

SEVERE

= 7

OFF

= 8

The EclipseLink categories for logging name space are:

SQL

= "sql"

TRANSACTION

= "transaction"

EVENT

= "event"

QUERY

= "query"

CACHE

= "cache"

PROPAGATION

= "propagation"

SEQUENCING

= "sequencing"

EJB

= "ejb"

DMS

= "dms"

EJB_ANNOTATION

= "ejb_annotation"

WEAVER

= "weaver"

PROPERTIES

= "properties"

SERVER

= "server"

setLevel

void setLevel(int level)

PUBLIC:
Set the log level. Used when session is not available.

The EclipseLink logging levels available are:

ALL

= 0

FINEST

= 1

FINER

= 2

FINE

= 3

CONFIG

= 4

INFO

= 5

WARNING

= 6

SEVERE

= 7

OFF

= 8

setLevel

void setLevel(int level,
java.lang.String category)

PUBLIC:
Set the log level. Category is only needed where name space
is available.

The EclipseLink logging levels available are:

ALL

= 0

FINEST

= 1

FINER

= 2

FINE

= 3

CONFIG

= 4

INFO

= 5

WARNING

= 6

SEVERE

= 7

OFF

= 8

The EclipseLink categories for logging name space are:

SQL

= "sql"

TRANSACTION

= "transaction"

EVENT

= "event"

QUERY

= "query"

CACHE

= "cache"

PROPAGATION

= "propagation"

SEQUENCING

= "sequencing"

EJB

= "ejb"

DMS

= "dms"

EJB_ANNOTATION

= "ejb_annotation"

WEAVER

= "weaver"

shouldLog

boolean shouldLog(int level)

PUBLIC:
Check if a message of the given level would actually be logged.
Used when session is not available.

The Eclipselink logging levels available are:

ALL

= 0

FINEST

= 1

FINER

= 2

FINE

= 3

CONFIG

= 4

INFO

= 5

WARNING

= 6

SEVERE

= 7

OFF

= 8

shouldLog

boolean shouldLog(int level,
java.lang.String category)

PUBLIC:
Check if a message of the given level would actually be logged.
Category is only needed where name space is available.

The EclipseLink logging levels available are:

ALL

= 0

FINEST

= 1

FINER

= 2

FINE

= 3

CONFIG

= 4

INFO

= 5

WARNING

= 6

SEVERE

= 7

OFF

= 8

The EclipseLink categories for logging name space are:

SQL

= "sql"

TRANSACTION

= "transaction"

EVENT

= "event"

QUERY

= "query"

CACHE

= "cache"

PROPAGATION

= "propagation"

SEQUENCING

= "sequencing"

EJB

= "ejb"

DMS

= "dms"

EJB_ANNOTATION

= "ejb_annotation"

WEAVER

= "weaver"

log

void log(int level,
java.lang.String message)

PUBLIC:
Log a message that does not need to be translated. This method is intended for
external use when logging messages are wanted within the EclipseLink output.