Search in sources :

Example 26 with LoggerContextSource

use of org.apache.logging.log4j.core.test.junit.LoggerContextSource in project logging-log4j2 by apache.

the class RecyclerFactoriesTest method test_RecyclerFactoryConverter_using_XML_config.

@Test
@LoggerContextSource("recyclerFactoryCustomizedJsonTemplateLayoutLogging.xml")
void test_RecyclerFactoryConverter_using_XML_config(@Named(value = "List") final ListAppender appender) throws Exception {
    final JsonTemplateLayout layout = (JsonTemplateLayout) appender.getLayout();
    final Field field = JsonTemplateLayout.class.getDeclaredField("contextRecycler");
    field.setAccessible(true);
    final QueueingRecycler<?> contextRecycler = (QueueingRecycler<?>) field.get(layout);
    final MpmcArrayQueue<?> queue = (MpmcArrayQueue<?>) contextRecycler.getQueue();
    Assertions.assertThat(queue.capacity()).isEqualTo(512);
}
Also used : Field(java.lang.reflect.Field) MpmcArrayQueue(org.jctools.queues.MpmcArrayQueue) JsonTemplateLayout(org.apache.logging.log4j.layout.template.json.JsonTemplateLayout) Test(org.junit.jupiter.api.Test) LoggerContextSource(org.apache.logging.log4j.core.test.junit.LoggerContextSource)

Aggregations

LoggerContextSource (org.apache.logging.log4j.core.test.junit.LoggerContextSource)26 Test (org.junit.jupiter.api.Test)26 Logger (org.apache.logging.log4j.Logger)14 Path (java.nio.file.Path)9 Filter (org.apache.logging.log4j.core.Filter)7 Appender (org.apache.logging.log4j.core.Appender)4 LoggerConfig (org.apache.logging.log4j.core.config.LoggerConfig)4 ThresholdFilter (org.apache.logging.log4j.core.filter.ThresholdFilter)4 ListAppender (org.apache.logging.log4j.core.test.appender.ListAppender)4 Collection (java.util.Collection)2 ExtendedLogger (org.apache.logging.log4j.spi.ExtendedLogger)2 StatusLogger (org.apache.logging.log4j.status.StatusLogger)2 IndexedReadOnlyStringMap (org.apache.logging.log4j.util.IndexedReadOnlyStringMap)2 Tag (org.junit.jupiter.api.Tag)2 Row (com.datastax.driver.core.Row)1 Session (com.datastax.driver.core.Session)1 Field (java.lang.reflect.Field)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 UUID (java.util.UUID)1