Package ch.qos.logback.classic.spi

Examples of ch.qos.logback.classic.spi.LoggingEvent


  }


  @Test
  public void nullMarker() throws EvaluationException {
    LoggingEvent event = makeEvent("x");
    doEvaluateAndCheck("e.marker?.name == 'YELLOW'", event, false);
  }
View Full Code Here


    doEvaluateAndCheck("e.marker?.name == 'YELLOW'", event, false);
  }

  @Test
  public void marker() throws EvaluationException {
    LoggingEvent event = makeEvent("x");
    event.setMarker(markerA);
    doEvaluateAndCheck("e.marker?.name == 'A'", event, true);
  }
View Full Code Here

    doEvaluateAndCheck("e.marker?.name == 'A'", event, true);
  }

  @Test
  public void nullMDC() throws EvaluationException {
    LoggingEvent event = makeEvent("x");
    doEvaluateAndCheck("e.mdc?.get('key') == 'val'", event, false);
  }
View Full Code Here

  }

  @Test
  public void mdc() throws EvaluationException {
    MDC.put("key", "val");
    LoggingEvent event = makeEvent("x");
    doEvaluateAndCheck("e.mdc['key'] == 'val'", event, true);
    MDC.clear();
  }
View Full Code Here

    MDC.clear();
  }

  @Test
  public void callerData() throws EvaluationException {
    LoggingEvent event = makeEvent("x");
    doEvaluateAndCheck("e.callerData.find{ it.className =~ /junit/ }", event, true);
  }
View Full Code Here

    assertNotNull(evalMap);
    JaninoEventEvaluator evaluator = (JaninoEventEvaluator) evalMap.get("msgEval");
    assertNotNull(evaluator);
   
    Logger logger = loggerContext.getLogger("xx");
    ILoggingEvent event0 = new LoggingEvent("foo", logger, Level.DEBUG, "Hello world", null, null);
    assertTrue(evaluator.evaluate(event0));
   
    ILoggingEvent event1 = new LoggingEvent("foo", logger, Level.DEBUG, "random blurb", null, null);
    assertFalse(evaluator.evaluate(event1));
  }
View Full Code Here

    assertNotNull(evalMap);
   
    Logger logger = loggerContext.getLogger("xx");
   
    JaninoEventEvaluator evaluator = (JaninoEventEvaluator) evalMap.get("IGNORE_EVAL");
    LoggingEvent event = new LoggingEvent("foo", logger, Level.DEBUG, "Hello world",null, null);

    Marker ignoreMarker = MarkerFactory.getMarker("IGNORE");
    event.setMarker(ignoreMarker);
    assertTrue(evaluator.evaluate(event));
   
    logger.debug("hello", new Exception("test"));
    logger.debug(ignoreMarker, "hello ignore", new Exception("test"));
   
View Full Code Here

    ee.setExpression("message.contains(\"stacktrace\") && message.contains(\"logging\")");
    ee.start();
    //StatusPrinter.print(loggerContext);
   
    String message = "stacktrace bla bla logging";
    ILoggingEvent event = new LoggingEvent(this.getClass().getName(), logger, Level.DEBUG, message, null, null);
   
    assertTrue(ee.evaluate(event));
  }
View Full Code Here

  public void datesLessThanTen() {
    // RFC 3164, section 4.1.2:
    // If the day of the month is less than 10, then it MUST be represented as
    // a space and then the number.  For example, the 7th day of August would be
    // represented as "Aug  7", with two spaces between the "g" and the "7".
    LoggingEvent le = createLoggingEvent();
    calendar.set(2012, Calendar.AUGUST, 7, 13, 15, 0);
    le.setTimeStamp(calendar.getTimeInMillis());
    assertEquals("<191>Aug  7 13:15:00 " + HOSTNAME + " ", converter.convert(le));
  }
View Full Code Here

    assertEquals("<191>Aug  7 13:15:00 " + HOSTNAME + " ", converter.convert(le));
  }

  @Test
  public void datesGreaterThanTen() {
    LoggingEvent le = createLoggingEvent();
    calendar.set(2012, Calendar.OCTOBER, 11, 22, 14, 15);
    le.setTimeStamp(calendar.getTimeInMillis());
    assertEquals("<191>Oct 11 22:14:15 " + HOSTNAME + " ", converter.convert(le));
  }
View Full Code Here

TOP

Related Classes of ch.qos.logback.classic.spi.LoggingEvent

Copyright © 2018 www.massapicom. 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.