Example #1
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));
   }
 }
Example #2
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()));
       }
     }
   }
 }