public class Slf4jSessionLogger
extends org.eclipse.persistence.logging.AbstractSessionLog
This is a wrapper class for SLF4J. It is used when messages need to be logged through SLF4J.
Use the follwing configuration for using SLF4J with EclipseLink
eclipselink.logging.logger
and the value
org.eclipse.persistence.logging.Slf4jSessionLogger
Use the following categories from EclipseLink (eclipselink.logging.timestamp, eclipselink.logging.thread, eclipselink.logging.session, eclipselink.logging.connection y eclipselink.logging.parameters).
Logging categories available are:
Mapping of Java Log Level to SLF4J Log Level:
see https://gist.github.com/msosvi/1325764/raw/50 a882f881c2651f6de10cf661813faca22a480d/Slf4jSessionLogger.java
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Slf4jSessionLogger.LogLevel
SLF4J log levels.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,org.slf4j.Logger> |
categoryLoggers |
static java.lang.String |
DEFAULT_CATEGORY |
static java.lang.String |
DEFAULT_ECLIPSELINK_NAMESPACE |
static java.lang.String |
ECLIPSELINK_NAMESPACE |
private static java.util.Map<java.lang.Integer,Slf4jSessionLogger.LogLevel> |
MAP_LEVELS |
CONFIG_PREFIX, CONNECTION_STRING, DATE_FORMAT_STR, dateFormat, defaultLog, FINE_PREFIX, FINER_PREFIX, FINEST_PREFIX, INFO_PREFIX, level, session, SEVERE_PREFIX, shouldDisplayData, shouldLogExceptionStackTrace, shouldPrintConnection, shouldPrintDate, shouldPrintSession, shouldPrintThread, THREAD_STRING, TOPLINK_PREFIX, WARNING_PREFIX, writer
ALL, ALL_LABEL, CACHE, CONFIG, CONFIG_LABEL, CONNECTION, DBWS, DDL, DMS, EJB, EJB_OR_METADATA, EVENT, FINE, FINE_LABEL, FINER, FINER_LABEL, FINEST, FINEST_LABEL, INFO, INFO_LABEL, JPA, JPARS, loggerCatagories, METADATA, METAMODEL, MISC, MONITORING, MOXY, OFF, OFF_LABEL, PROPAGATION, PROPERTIES, QUERY, SEQUENCING, SERVER, SEVERE, SEVERE_LABEL, SQL, TRANSACTION, WARNING, WARNING_LABEL, WEAVER
Constructor and Description |
---|
Slf4jSessionLogger() |
Modifier and Type | Method and Description |
---|---|
private void |
addLogger(java.lang.String loggerCategory,
java.lang.String loggerNameSpace)
INTERNAL: Add Logger to the categoryLoggers.
|
private void |
createCategoryLoggers()
Initialize loggers eagerly
|
private org.slf4j.Logger |
getLogger(java.lang.String category)
INTERNAL: Return the Logger for the given category
|
private Slf4jSessionLogger.LogLevel |
getLogLevel(java.lang.Integer level)
Return the corresponding Slf4j Level for a given EclipseLink level.
|
static boolean |
hasText(java.lang.String str) |
void |
log(org.eclipse.persistence.logging.SessionLogEntry entry) |
boolean |
shouldDisplayData()
Return true if SQL logging should log visible bind parameters.
|
boolean |
shouldLog(int level) |
boolean |
shouldLog(int level,
java.lang.String category) |
clone, config, fine, finer, finest, formatMessage, getConnectionString, getDateFormat, getDateString, getDefaultLoggingLevel, getLevel, getLevel, getLevelString, getLog, getSession, getSessionString, getSupplementDetailString, getThreadString, getWriter, info, isOff, log, log, log, log, log, log, log, log, log, log, log, log, log, logThrowable, logThrowable, printPrefixString, setDateFormat, setLevel, setLevel, setLog, setSession, setShouldDisplayData, setShouldLogExceptionStackTrace, setShouldPrintConnection, setShouldPrintDate, setShouldPrintSession, setShouldPrintThread, setWriter, setWriter, severe, shouldLogExceptionStackTrace, shouldPrintConnection, shouldPrintDate, shouldPrintSession, shouldPrintThread, throwing, translateLoggingLevelToString, translateStringToLoggingLevel, warning
public static final java.lang.String ECLIPSELINK_NAMESPACE
public static final java.lang.String DEFAULT_CATEGORY
public static final java.lang.String DEFAULT_ECLIPSELINK_NAMESPACE
private static java.util.Map<java.lang.Integer,Slf4jSessionLogger.LogLevel> MAP_LEVELS
private java.util.Map<java.lang.String,org.slf4j.Logger> categoryLoggers
public void log(org.eclipse.persistence.logging.SessionLogEntry entry)
log
in interface org.eclipse.persistence.logging.SessionLog
log
in class org.eclipse.persistence.logging.AbstractSessionLog
public boolean shouldLog(int level, java.lang.String category)
shouldLog
in interface org.eclipse.persistence.logging.SessionLog
shouldLog
in class org.eclipse.persistence.logging.AbstractSessionLog
public boolean shouldLog(int level)
shouldLog
in interface org.eclipse.persistence.logging.SessionLog
shouldLog
in class org.eclipse.persistence.logging.AbstractSessionLog
public boolean shouldDisplayData()
shouldDisplayData
in interface org.eclipse.persistence.logging.SessionLog
shouldDisplayData
in class org.eclipse.persistence.logging.AbstractSessionLog
private void createCategoryLoggers()
private void addLogger(java.lang.String loggerCategory, java.lang.String loggerNameSpace)
private org.slf4j.Logger getLogger(java.lang.String category)
private Slf4jSessionLogger.LogLevel getLogLevel(java.lang.Integer level)
public static boolean hasText(java.lang.String str)