示例#1
0
 /**
  * Logs throwing an exception. If the current logging context is not a {@link StandardLog} an
  * {@link LogContext#logError error} is logged.
  *
  * @param sourceClass name of class that issued the logging request.
  * @param sourceMethod name of the method.
  * @param thrown the error that is being thrown.
  */
 public static void throwing(String sourceClass, String sourceMethod, Throwable thrown) {
   LogContext log = (LogContext) LogContext.getCurrent();
   if (log instanceof StandardLog) {
     ((StandardLog) log)._logger.throwing(sourceClass, sourceMethod, thrown);
   } else if (log.isErrorLogged()) {
     log.logError(thrown, (CharSequence) null);
   }
 }
示例#2
0
 /**
  * Logs a {@link Level#SEVERE SEVERE} message. If the current logging context is not a {@link
  * StandardLog} a {@link LogContext#warning warning} message is logged.
  *
  * @param msg the severe message.
  */
 public static void severe(String msg) {
   LogContext log = (LogContext) LogContext.getCurrent();
   if (log instanceof StandardLog) {
     ((StandardLog) log)._logger.severe(msg);
   } else if (log.isWarningLogged()) {
     log.logWarning(Javolution.j2meToCharSeq(msg));
   }
 }
示例#3
0
 /**
  * Log a specific LogRecord. If the current logging context is not a {@link StandardLog}, an
  * {@link LogContext#logError error}, {@link LogContext#logWarning warning} or {@link
  * LogContext#logInfo info} is possibly logged.
  *
  * @param record the LogRecord to be published.
  */
 public static void log(LogRecord record) {
   LogContext log = (LogContext) LogContext.getCurrent();
   if (log instanceof StandardLog) {
     ((StandardLog) log)._logger.log(record);
   } else {
     Throwable error = record.getThrown();
     if (error != null) {
       if (log.isErrorLogged()) {
         log.logError(error, Javolution.j2meToCharSeq(record.getMessage()));
       }
     } else if (record.getLevel().intValue() > Level.WARNING.intValue()) {
       if (log.isWarningLogged()) {
         log.logWarning(Javolution.j2meToCharSeq(record.getMessage()));
       }
     } else if (record.getLevel().intValue() > Level.INFO.intValue()) {
       if (log.isInfoLogged()) {
         log.logInfo(Javolution.j2meToCharSeq(record.getMessage()));
       }
     }
   }
 }
示例#4
0
 /**
  * Log a method return. If the current logging context is not a {@link StandardLog} no return is
  * logged.
  *
  * @param sourceClass name of class that issued the logging request.
  * @param sourceMethod name of method that is being returned.
  */
 public static void exiting(String sourceClass, String sourceMethod) {
   LogContext log = (LogContext) LogContext.getCurrent();
   if (log instanceof StandardLog) {
     ((StandardLog) log)._logger.exiting(sourceClass, sourceMethod);
   }
 }
示例#5
0
 /**
  * Logs a {@link Level#FINEST FINEST} message. If the current logging context is not a {@link
  * StandardLog} no message is logged.
  *
  * @param msg the finest message.
  */
 public static void finest(String msg) {
   LogContext log = (LogContext) LogContext.getCurrent();
   if (log instanceof StandardLog) {
     ((StandardLog) log)._logger.finest(msg);
   }
 }