Example #1
0
 private boolean checkActivate() {
   if (!activated) {
     try {
       activated = activateHandler();
     } catch (Exception e) {
       Kernel.logError("Fail to active appender " + this.getClass() + ". Cause " + e.getMessage());
     }
   }
   return activated;
 }
Example #2
0
 /**
  * Handle log message
  *
  * @param msg Log message
  */
 public synchronized void doAppend(LogMessage msg) {
   checkActivate();
   if (filter != null && filter.filter(msg) != LoggerFilter.ALLOW) {
     return;
   }
   String log = null;
   if (layout != null && needPattern() && layout.getConvertor() != null) {
     log = layout.format(msg);
   }
   try {
     append(msg, log);
   } catch (Exception e) {
     Kernel.logError(e.getMessage(), e);
   }
 }