Package org.apache.log4j

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


    Logger logger = LogManager.getLogger(TestLog4jAppender.class);
    Thread.currentThread().setName("Log4jAppenderTest");
    int level = 10000;
    String msg = "This is log message number" + String.valueOf(1);
    try {
      logger.log(Level.toLevel(level), msg);
    } catch (FlumeException ex) {
      throw ex.getCause();
    }
  }
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

        if (!log.isEnabledFor(priority)) {
            return;
        }

        log.log(Log4jSink.class.getName(), priority, "" + msg, null);
    }

    public synchronized void log(String s) {
        Logger.getRootLogger().log("jetty.log4jSink", Level.INFO, s, null);
    }
View Full Code Here

    @Test
    public void testIndirectErrorLogMessage() {
        String msg = "testIndirectErrorLogMessage";
        Logger logger = Logger.getLogger(getClass());
        logger.log(Level.ERROR, msg);
        assertLoggingOperation(logger, "ERROR", msg, null);
    }

    @Test
    public void testIndirectErrorLogMessageWithException() {
View Full Code Here

    @Test
    public void testIndirectErrorLogMessageWithException() {
        String msg = "testIndirectErrorLogMessageWithException";
        Logger logger = Logger.getLogger(getClass());
        Throwable t = new IllegalArgumentException(msg);
        logger.log(Level.ERROR, msg, t);
        assertLoggingOperation(logger, "ERROR", msg, t);
    }

    @Test
    public void testIndirectFatalLogMessage() {
View Full Code Here

    @Test
    public void testIndirectFatalLogMessage() {
        String msg = "testIndirectFatalLogMessage";
        Logger logger = Logger.getLogger(getClass());
        logger.log(Level.FATAL, msg);
        assertLoggingOperation(logger, "FATAL", msg, null);
    }

    @Test
    public void testIndirectFatalLogMessageWithException() {
View Full Code Here

    @Test
    public void testIndirectFatalLogMessageWithException() {
        String msg = "testIndirectFatalLogMessageWithException";
        Logger logger = Logger.getLogger(getClass());
        Throwable t = new IllegalArgumentException(msg);
        logger.log(Level.FATAL, msg, t);
        assertLoggingOperation(logger, "FATAL", msg, t);
    }

    @Override
    public Log4jLoggingOperationCollectionAspect getAspect() {
View Full Code Here

    cat.error("Message " + ++i);
    root.error("Message " + i);
   
    cat.log(Level.FATAL, "Message " + ++i);
    root.log(Level.FATAL, "Message " + i);   
   
    Exception e = new Exception("Just testing");
    cat.debug("Message " + ++i, e);
    root.debug("Message " + i, e);
   
View Full Code Here

    cat.error("Message " + ++i);
    root.error("Message " + i);

    cat.log(Level.FATAL, "Message " + ++i);
    root.log(Level.FATAL, "Message " + i);

    Exception e = new Exception("Just testing");
    cat.debug("Message " + ++i, e);
    root.debug("Message " + i, e);
View Full Code Here

       * default.
       */
      int level = ((count % 5)+1)*10000;
      String msg = "This is log message number" + String.valueOf(count);

      logger.log(Level.toLevel(level), msg);
      Transaction transaction = ch.getTransaction();
      transaction.begin();
      Event event = ch.take();
      Assert.assertNotNull(event);
      Assert.assertEquals(new String(event.getBody(), "UTF8"), msg);
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.