/** * Return the supplement detail information including date, session, thread and connection. */ protected String getSupplementDetailString(SessionLogEntry entry) { StringWriter writer = new StringWriter(); if (shouldPrintDate()) { writer.write(getDateString(entry.getDate())); writer.write("--"); } if (shouldPrintSession() && (entry.getSession() != null)) { writer.write(this.getSessionString(entry.getSession())); writer.write("--"); } if (shouldPrintConnection() && (entry.getConnection() != null)) { writer.write(this.getConnectionString(entry.getConnection())); writer.write("--"); } if (shouldPrintThread()) { writer.write(this.getThreadString(entry.getThread())); writer.write("--"); } return writer.toString(); }
/** * PUBLIC: * Log the log entry. */ public void log(SessionLogEntry entry) { if (shouldLog(entry.getLevel(), entry.getNameSpace())) { if (entry.getSession() == null) {// Used for proxy session. entry.setSession(this); } getSessionLog().log(entry); } }
/** * INTERNAL: * <p> * Build a LogRecord * </p><p> * @param entry SessionLogEntry that holds all the information for a TopLink logging event * @param javaLevel the message level * </p> */ protected void internalLog(SessionLogEntry entry, Level javaLevel, Logger logger) { // Format message so that we do not depend on the bundle TopLinkLogRecord lr = new TopLinkLogRecord(javaLevel, formatMessage(entry)); lr.setSourceClassName(null); lr.setSourceMethodName(null); lr.setLoggerName(getNameSpaceString(entry.getNameSpace())); if (shouldPrintSession()) { lr.setSessionString(getSessionString(entry.getSession())); } if (shouldPrintConnection()) { lr.setConnection(entry.getConnection()); } lr.setThrown(entry.getException()); lr.setShouldLogExceptionStackTrace(shouldLogExceptionStackTrace()); lr.setShouldPrintDate(shouldPrintDate()); lr.setShouldPrintThread(shouldPrintThread()); logger.log(lr); }