Ejemplo n.º 1
0
 public void forcedLog(
     final String fqcn, final Priority level, final Object message, final Throwable t) {
   final org.apache.logging.log4j.Level lvl =
       org.apache.logging.log4j.Level.toLevel(level.toString());
   final Message msg = message instanceof Message ? (Message) message : new ObjectMessage(message);
   logger.logMessage(fqcn, lvl, null, msg, t);
 }
Ejemplo n.º 2
0
 protected void __doBuildEx(Object info, Throwable e, ILogger.LogLevel level, Marker marker) {
   StringBuilder _exSB =
       new StringBuilder(
               DateTimeUtils.formatTime(
                   System.currentTimeMillis(), DateTimeUtils.YYYY_MM_DD_HH_MM_SS_SSS))
           .append(level.getDispName())
           .append('[')
           .append(Thread.currentThread().getId())
           .append(':')
           .append(__doMakeCallerInfo())
           .append(']')
           .append(' ')
           .append(info == null ? StringUtils.EMPTY : StringUtils.trimToEmpty(info.toString()));
   if (e != null) {
     StringBuilder _stackSB =
         new StringBuilder(e.getClass().getName())
             .append(": ")
             .append(StringUtils.EMPTY)
             .append(StringUtils.trimToEmpty(e.getMessage()))
             .append("\n");
     StackTraceElement[] _stacks = e.getStackTrace();
     for (StackTraceElement _stack : _stacks) {
       _stackSB.append("\tat ").append(_stack).append("\n");
     }
     __ex(_stackSB, e.getCause());
     _exSB.append("- ").append(_stackSB);
   }
   __logger.log(Level.toLevel(level.getName(), Level.ALL), getMarker(marker), _exSB.toString());
   //
   if (__allowOutputConsole) {
     System.out.println(_exSB.toString());
   }
 }
 private static AsyncEventRouter createDiscardingAsyncEventRouter() {
   final PropertiesUtil util = PropertiesUtil.getProperties();
   final String level =
       util.getStringProperty(PROPERTY_NAME_DISCARDING_THRESHOLD_LEVEL, Level.INFO.name());
   final Level thresholdLevel = Level.toLevel(level, Level.INFO);
   LOGGER.debug("Creating custom DiscardingAsyncEventRouter(discardThreshold:{})", thresholdLevel);
   return new DiscardingAsyncEventRouter(thresholdLevel);
 }
Ejemplo n.º 4
0
  public LoggerFactorySpecial(long maxSize, int maxBackups, String levels) {
    String p = System.getProperty("tds.log.dir");
    if (p != null) dir = p;

    this.maxSize = maxSize;
    this.maxBackups = maxBackups;
    try {
      Level tlevel = Level.toLevel(levels);
      if (tlevel != null) level = tlevel;
    } catch (Exception e) {
      startupLog.error("Illegal Logger level=" + levels);
    }
  }
Ejemplo n.º 5
0
 public boolean isEnabledFor(final Priority level) {
   final org.apache.logging.log4j.Level lvl =
       org.apache.logging.log4j.Level.toLevel(level.toString());
   return isEnabledFor(lvl);
 }
Ejemplo n.º 6
0
 public void setPriority(final Priority priority) {
   logger.setLevel(org.apache.logging.log4j.Level.toLevel(priority.levelStr));
 }
Ejemplo n.º 7
0
 public void setLevel(final Level level) {
   logger.setLevel(org.apache.logging.log4j.Level.toLevel(level.levelStr));
 }
Ejemplo n.º 8
0
 private Result filter(Level level) {
   return level.isAtLeastAsSpecificAs(Level.toLevel(System.getProperty(property), Level.INFO))
       ? onMatch
       : onMismatch;
 }