public SessionLog getServerLog() { return new JavaLog(); } }
/** * PUBLIC: * <p> * 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 * </p><p> * @return true if the given message level will be logged * </p> */ public boolean shouldLog(int level, String category) { Logger logger = getLogger(category); return logger.isLoggable(getJavaLevel(level)); }
/** * 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); }
/** * PUBLIC: * <p> * Log a SessionLogEntry * </p><p> * @param entry SessionLogEntry that holds all the information for a TopLink logging event * </p> */ public void log(SessionLogEntry entry) { if (!shouldLog(entry.getLevel(), entry.getNameSpace())) { return; } Logger logger = getLogger(entry.getNameSpace()); Level javaLevel = getJavaLevel(entry.getLevel()); internalLog(entry, javaLevel, logger); }
/** * PUBLIC: * <p> * Set the log level to a logger with name space extracted from the given category. * </p> */ public void setLevel(final int level, String category) { final Logger logger = getLogger(category); if (logger == null) { return; } AccessController.doPrivileged(new PrivilegedAction() { public Object run() { logger.setLevel(getJavaLevel(level)); return null; // nothing to return } }); }
/** * PUBLIC: * <p> * Log a throwable. * </p><p> * @param throwable a throwable * </p> */ public void throwing(Throwable throwable) { getLogger(null).throwing(null, null, throwable); }
/** * PUBLIC: * <p> * 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. * </p><p> * * @return the effective log level. * </p> */ public int getLevel(String category) { Logger logger = getLogger(category); while ((logger != null) && (logger.getLevel() == null)) { logger = logger.getParent(); } if (logger == null) { return OFF; } //For a given java.util.logging.Level, return the index (ie, TopLink logging level) int logLevel = logger.getLevel().intValue(); for (int i = 0; i < levels.length ; i++) { if (logLevel == levels[i].intValue()) { return i; } } return OFF; }
/** * INTERNAL: getServerLog(): Return the ServerLog for this platform * * Return JavaLog for Oc4jPlatform * * @return oracle.toplink.essentials.logging.SessionLog */ //Bug5389724 public SessionLog getServerLog() { return new JavaLog(); } }