Top Description Fields Constructors Methods
org.eclipse.persistence.logging

public Class JavaLog

extends AbstractSessionLog
Class Inheritance
Imports
java.io.OutputStream, java.security.AccessController, .PrivilegedAction, java.util.HashMap, .Map, java.util.logging.Level, .Logger, .StreamHandler, org.eclipse.persistence.sessions.Session

PUBLIC:

This is a wrapper class for java.util.logging. It is used when messages need to be logged through java.util.logging.

See Also
SessionLog, AbstractSessionLog, SessionLogEntry, Session

Field Summary

Modifier and TypeField and Description
private final Map<String, Logger>
private static final Level[]
levels

Stores all the java.util.logging.Levels.

protected static final String
private final Map<String, String>
nameSpaceMap

Represents the HashMap that stores all the name space strings.

private Logger
sessionLogger

Stores the Logger for session namespace, i.e. "org.eclipse.persistence.session.

private String
sessionNameSpace

Stores the namespace for session, i.e."org.eclipse.persistence.session.

protected static final String
Inherited from org.eclipse.persistence.logging.AbstractSessionLog:
CONFIG_PREFIXCONNECTION_STRINGDATE_FORMAT_STRdateFormatdefaultLogFINE_PREFIXFINER_PREFIXFINEST_PREFIXINFO_PREFIXlevelsessionSEVERE_PREFIXshouldDisplayDatashouldLogExceptionStackTraceshouldPrintConnectionshouldPrintDateshouldPrintSessionshouldPrintThreadTHREAD_STRINGTOPLINK_PREFIXWARNING_PREFIXwriter

Constructor Summary

AccessConstructor and Description
public
JavaLog()

INTERNAL:

Method Summary

Modifier and TypeMethod and Description
protected void
addLogger(String loggerCategory, String loggerNameSpace)

INTERNAL: Add Logger to the categoryloggers.

public Object
clone()

Overrides org.eclipse.persistence.logging.AbstractSessionLog.clone.

Implements org.eclipse.persistence.logging.SessionLog.clone.

INTERNAL: Each session owns its own session log because session is stored in the session log
public Map<String, Logger>
getCategoryLoggers()

INTERNAL: Return catagoryloggers

protected Level
getJavaLevel(int level)

INTERNAL: Return the corresponding java.util.logging.Level for a given TopLink level.

public int

Returns:

the effective log level.
getLevel
(String
the string representation of a EclipseLink category, e.g. "sql", "transaction" ...
category
)

Overrides org.eclipse.persistence.logging.AbstractSessionLog.getLevel.

Implements org.eclipse.persistence.logging.SessionLog.getLevel.

PUBLIC:

Return the effective log level for the name space extracted from session and category.

protected Logger
getLogger(String category)

INTERNAL: Return the Logger for the given category

protected String
getNameSpaceString(String category)

INTERNAL: Return the name space for the given category from the map.

protected void
internalLog(SessionLogEntry
SessionLogEntry that holds all the information for a TopLink logging event
entry
,
Level
the message level
javaLevel
,
Logger logger)

INTERNAL:

Build a LogRecord

public void
log(SessionLogEntry
SessionLogEntry that holds all the information for a TopLink logging event
entry
)

Implements abstract org.eclipse.persistence.logging.AbstractSessionLog.log.

Implements org.eclipse.persistence.logging.SessionLog.log.

PUBLIC:

Log a SessionLogEntry

public void
setLevel(final int
the new log level
level
,
String
the string representation of an EclipseLink category, e.g. "sql", "transaction" ...
category
)

Overrides org.eclipse.persistence.logging.AbstractSessionLog.setLevel.

Implements org.eclipse.persistence.logging.SessionLog.setLevel.

PUBLIC:

Set the log level to a logger with name space extracted from the given category.

public void
setSession(Session
a Session
session
)

Overrides org.eclipse.persistence.logging.AbstractSessionLog.setSession.

Implements org.eclipse.persistence.logging.SessionLog.setSession.

PUBLIC:

Set the session and session namespace.

public void
setWriter(OutputStream
the file output stream will receive the formatted log entries.
fileOutputStream
)

Overrides org.eclipse.persistence.logging.AbstractSessionLog.setWriter.

PUBLIC:

Set the output stream that will receive the formatted log entries.

public boolean

Returns:

true if the given message level will be logged
shouldLog
(int
the log request level
level
,
String
the string representation of an EclipseLink category, e.g. "sql", "transaction" ...*
category
)

Overrides org.eclipse.persistence.logging.AbstractSessionLog.shouldLog.

Implements org.eclipse.persistence.logging.SessionLog.shouldLog.

PUBLIC:

Check if a message of the given level would actually be logged by the logger with name space built from the given session and category.

public void
Inherited from org.eclipse.persistence.logging.AbstractSessionLog:
configfinefinerfinestformatMessagegetConnectionStringgetDateFormatgetDateStringgetDefaultLoggingLevelgetLevelgetLevelStringgetLoggetSessiongetSessionStringgetSupplementDetailStringgetThreadStringgetWriterinfoisOffloglogloglogloglogloglogloglogloglogloglogThrowablelogThrowableprintPrefixStringsetDateFormatsetLevelsetLogsetShouldDisplayDatasetShouldLogExceptionStackTracesetShouldPrintConnectionsetShouldPrintDatesetShouldPrintSessionsetShouldPrintThreadsetWritersevereshouldDisplayDatashouldLogshouldLogExceptionStackTraceshouldPrintConnectionshouldPrintDateshouldPrintSessionshouldPrintThreadtranslateLoggingLevelToStringtranslateStringToLoggingLevelwarning

Field Detail

categoryloggersback to summary
private final Map<String, Logger> categoryloggers
levelsback to summary
private static final Level[] levels

Stores all the java.util.logging.Levels. The indexes are TopLink logging levels.

LOGGING_LOCALIZATION_STRINGback to summary
protected static final String LOGGING_LOCALIZATION_STRING
nameSpaceMapback to summary
private final Map<String, String> nameSpaceMap

Represents the HashMap that stores all the name space strings. The keys are category names. The values are namespace strings.

sessionLoggerback to summary
private Logger sessionLogger

Stores the Logger for session namespace, i.e. "org.eclipse.persistence.session.<sessionname>".

sessionNameSpaceback to summary
private String sessionNameSpace

Stores the namespace for session, i.e."org.eclipse.persistence.session.<sessionname>".

TRACE_LOCALIZATION_STRINGback to summary
protected static final String TRACE_LOCALIZATION_STRING

Constructor Detail

JavaLogback to summary
public JavaLog()

INTERNAL:

Method Detail

addLoggerback to summary
protected void addLogger(String loggerCategory, String loggerNameSpace)

INTERNAL: Add Logger to the categoryloggers.

cloneback to summary
public Object clone()

Overrides org.eclipse.persistence.logging.AbstractSessionLog.clone.

Implements org.eclipse.persistence.logging.SessionLog.clone.

INTERNAL: Each session owns its own session log because session is stored in the session log

Returns:Object

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
getCategoryLoggersback to summary
public Map<String, Logger> getCategoryLoggers()

INTERNAL: Return catagoryloggers

getJavaLevelback to summary
protected Level getJavaLevel(int level)

INTERNAL: Return the corresponding java.util.logging.Level for a given TopLink level.

getLevelback to summary
public int getLevel(String category)

Overrides org.eclipse.persistence.logging.AbstractSessionLog.getLevel.

Implements org.eclipse.persistence.logging.SessionLog.getLevel.

PUBLIC:

Return the effective log level for the name space extracted from session and category. If a Logger's level is set to be null then the Logger will use an effective Level that will be obtained by walking up the parent tree and using the first non-null Level.

Parameters
category:String

Doc from org.eclipse.persistence.logging.AbstractSessionLog.getLevel.

the string representation of a EclipseLink category, e.g. "sql", "transaction" ...

Returns:int

the effective log level.

Annotations
@Override
getLoggerback to summary
protected Logger getLogger(String category)

INTERNAL: Return the Logger for the given category

getNameSpaceStringback to summary
protected String getNameSpaceString(String category)

INTERNAL: Return the name space for the given category from the map.

internalLogback to summary
protected void internalLog(SessionLogEntry entry, Level javaLevel, Logger logger)

INTERNAL:

Build a LogRecord

Parameters
entry:SessionLogEntry

SessionLogEntry that holds all the information for a TopLink logging event

javaLevel:Level

the message level

logback to summary
public void log(SessionLogEntry entry)

Implements abstract org.eclipse.persistence.logging.AbstractSessionLog.log.

Implements org.eclipse.persistence.logging.SessionLog.log.

PUBLIC:

Log a SessionLogEntry

Parameters
entry:SessionLogEntry

SessionLogEntry that holds all the information for a TopLink logging event

Annotations
@Override
setLevelback to summary
public void setLevel(final int level, String category)

Overrides org.eclipse.persistence.logging.AbstractSessionLog.setLevel.

Implements org.eclipse.persistence.logging.SessionLog.setLevel.

PUBLIC:

Set the log level to a logger with name space extracted from the given category.

Parameters
level:int

Doc from org.eclipse.persistence.logging.AbstractSessionLog.setLevel.

the new log level

category:String

Doc from org.eclipse.persistence.logging.AbstractSessionLog.setLevel.

the string representation of an EclipseLink category, e.g. "sql", "transaction" ...

Annotations
@Override
setSessionback to summary
public void setSession(Session session)

Overrides org.eclipse.persistence.logging.AbstractSessionLog.setSession.

Implements org.eclipse.persistence.logging.SessionLog.setSession.

PUBLIC:

Set the session and session namespace.

Parameters
session:Session

a Session

Annotations
@Override
setWriterback to summary
public void setWriter(OutputStream fileOutputStream)

Overrides org.eclipse.persistence.logging.AbstractSessionLog.setWriter.

PUBLIC:

Set the output stream that will receive the formatted log entries.

Parameters
fileOutputStream:OutputStream

the file output stream will receive the formatted log entries.

Annotations
@Override
shouldLogback to summary
public boolean shouldLog(int level, String category)

Overrides org.eclipse.persistence.logging.AbstractSessionLog.shouldLog.

Implements org.eclipse.persistence.logging.SessionLog.shouldLog.

PUBLIC:

Check if a message of the given level would actually be logged by the logger with name space built from the given session and category. Return the shouldLog for the given category from

Parameters
level:int

Doc from org.eclipse.persistence.logging.AbstractSessionLog.shouldLog.

the log request level

category:String

Doc from org.eclipse.persistence.logging.AbstractSessionLog.shouldLog.

the string representation of an EclipseLink category, e.g. "sql", "transaction" ...*

Returns:boolean

true if the given message level will be logged

Annotations
@Override
throwingback to summary
public void throwing(Throwable throwable)

Overrides org.eclipse.persistence.logging.AbstractSessionLog.throwing.

Implements org.eclipse.persistence.logging.SessionLog.throwing.

PUBLIC:

Log a throwable.

Parameters
throwable:Throwable

a throwable

Annotations
@Override