Search in sources :

Example 46 with LoggingEvent

use of org.apache.log4j.spi.LoggingEvent in project carbondata by apache.

the class ExtendedRollingFileAppenderTest_UT method testSubAppendLoggingEvent.

@Test
public void testSubAppendLoggingEvent() {
    Logger logger = Logger.getLogger(this.getClass());
    LoggingEvent event = new LoggingEvent(null, logger, 0L, AuditLevel.DEBUG, null, null);
    try {
        rAppender.subAppend(event);
    } catch (Exception e) {
    //
    }
    Assert.assertTrue(true);
}
Also used : LoggingEvent(org.apache.log4j.spi.LoggingEvent) Logger(org.apache.log4j.Logger) Test(org.junit.Test)

Example 47 with LoggingEvent

use of org.apache.log4j.spi.LoggingEvent in project cloudstack by apache.

the class SnmpEnhancedPatternLayoutTest method parseAlertTest.

@Test
public void parseAlertTest() {
    LoggingEvent event = mock(LoggingEvent.class);
    setMessage(" alertType:: 14 // dataCenterId:: 1 // podId:: 1 // " + "clusterId:: null // message:: Management" + " network CIDR is not configured originally. Set it default to 10.102.192.0/22", event);
    SnmpTrapInfo info = _snmpEnhancedPatternLayout.parseEvent(event);
    commonAssertions(info, "Management network CIDR is not configured originally. Set it default to 10.102.192" + ".0/22");
}
Also used : LoggingEvent(org.apache.log4j.spi.LoggingEvent) Test(org.junit.Test)

Example 48 with LoggingEvent

use of org.apache.log4j.spi.LoggingEvent in project cloudstack by apache.

the class SnmpEnhancedPatternLayoutTest method parseRandomTest.

@Test
public void parseRandomTest() {
    LoggingEvent event = mock(LoggingEvent.class);
    when(event.getRenderedMessage()).thenReturn("Problem clearing email alert");
    assertNull(" Null value was expected ", _snmpEnhancedPatternLayout.parseEvent(event));
}
Also used : LoggingEvent(org.apache.log4j.spi.LoggingEvent) Test(org.junit.Test)

Aggregations

LoggingEvent (org.apache.log4j.spi.LoggingEvent)48 Test (org.junit.Test)21 Logger (org.apache.log4j.Logger)12 Pattern (java.util.regex.Pattern)7 Matcher (java.util.regex.Matcher)6 ByteArrayOutputStream (org.apache.commons.io.output.ByteArrayOutputStream)6 AppenderSkeleton (org.apache.log4j.AppenderSkeleton)3 LoggingException (com.axway.ats.log.autodb.exceptions.LoggingException)2 AbstractLoggingEvent (com.axway.ats.log.autodb.model.AbstractLoggingEvent)2 IOException (java.io.IOException)2 Appender (org.apache.log4j.Appender)2 Category (org.apache.log4j.Category)2 Level (org.apache.log4j.Level)2 Filter (org.apache.log4j.spi.Filter)2 LocationInfo (org.apache.log4j.spi.LocationInfo)2 InsertMessageEvent (com.axway.ats.log.autodb.events.InsertMessageEvent)1 CacheableEvent (com.axway.ats.log.autodb.model.CacheableEvent)1 SystemLogLevel (com.axway.ats.log.model.SystemLogLevel)1 CurrentUser (com.google.gerrit.server.CurrentUser)1 IdentifiedUser (com.google.gerrit.server.IdentifiedUser)1