Package org.apache.log4j

Examples of org.apache.log4j.Logger.log()


    log4j.log(convert2Log4JLevel(level), msg);
  }

  public void log(int level, String context, Throwable t, Object msg) {
    Logger log4j = getLogger(context);
    log4j.log(convert2Log4JLevel(level), msg, t);
  }
 
  /**
   * Convert {@link MessageLevel} to {@link Level}
   * @param level
View Full Code Here


    Logger log4jLogger = Logger.getLogger("a");
    Category log4jCategory = Logger.getLogger("b");

    int n = 0;

    log4jLogger.log(org.apache.log4j.Level.DEBUG, "hello"+(++n));
    log4jCategory.log(org.apache.log4j.Level.DEBUG, "world"+(++n));
   
    assertEquals(n, listHandler.list.size());

    for (int i = 0; i < n; i++) {
View Full Code Here

  }

  @Override
  public void log(int level, String context, Object msg) {
    Logger log4j = getLogger(context);
    log4j.log(convert2Log4JLevel(level), msg);
  }

  public void log(int level, String context, Throwable t, Object msg) {
    Logger log4j = getLogger(context);
    log4j.log(convert2Log4JLevel(level), msg, t);
View Full Code Here

    int i  = 0;
    logger.debug( "Message " + i++);
    logger.info( "Message " + i++);
    logger.warn( "Message " + i++);
    logger.error( "Message " + i++);
    logger.log(Level.FATAL, "Message " + i++);
    logger.debug("Message " + i++,  new Exception("Just testing."));
  }
}
View Full Code Here

    long currentOffset, beginBlock;
    long  endBlock;
    long currentScn = -1;
    currentOffset = -1;
    endBlock = beginBlock = 0;
    newLog.log(l, "logger name: " + log.getName() + " ts:" + (new Date()));
    for (int position = 0; position < buffer.limit();  position += SIZE_OF_SCN_OFFSET_RECORD)
    {
      long nextOffset = getOffset(position);
      if (currentOffset < 0) currentOffset = nextOffset;
      long nextBlock = position/SIZE_OF_SCN_OFFSET_RECORD;
View Full Code Here

      long nextBlock = position/SIZE_OF_SCN_OFFSET_RECORD;
      long nextScn = getScn(position);
      if (currentScn < 0) currentScn = nextScn;
      if(nextOffset != currentOffset || currentScn != nextScn) {
        // new offset - print the previous line
        newLog.log(l, buildBlockIndexString(beginBlock, endBlock, currentScn, currentOffset));

        currentOffset = nextOffset;
        beginBlock = nextBlock;
        currentScn = nextScn;
      }
View Full Code Here

      endBlock = nextBlock;

      //log.log(p, i/SIZE_OF_SCN_OFFSET_RECORD + ":" + nextScn + "->" + nextOffset);
    }
    // final line
    newLog.log(l, buildBlockIndexString(beginBlock, endBlock, currentScn, currentOffset));
  }

  private String buildBlockIndexString(long beginBlock, long endBlock, long scn, long offset) {
    String block = "" + endBlock;
    if(beginBlock != endBlock)
View Full Code Here

                            }
                        } else {
                            throw new SyntaxFailureException("Element name is not 'syntax' or 'argument-bundle'");
                        }
                    } catch (Exception ex) {
                        log.log(Priority.WARN, "problem in syntax", ex);
                    }
                }
            }
        }
    }
View Full Code Here

    public void publish(final LogRecord record) {
        Logger targetLogger = Logger.getLogger(record.getLoggerName());
        final Priority targetLevel = levelMapper.getTargetLevelForSourceLevel(record.getLevel());
        final String text = formatRecord(record);
        targetLogger.log(LOGGER_CLASS_NAME, targetLevel, text, record.getThrown());
    }

    private String formatRecord(final LogRecord record) {
        final ResourceBundle bundle = record.getResourceBundle();
        String msg = record.getMessage();
View Full Code Here

            if (useLog4J) {
                Logger logger = getLogger(module);
                if (SYS_DEBUG != null) {
                    logger.setLevel(Level.DEBUG);
                }
                logger.log(callingClass, levelObjs[level], msg, t);
            } else {
                StringBuilder prefixBuf = new StringBuilder();

                prefixBuf.append(dateFormat.format(new java.util.Date()));
                prefixBuf.append(" [OFBiz");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.