use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.
the class AsyncLoggersLocationBenchmark method up.
@Setup(Level.Trial)
public void up() {
System.setProperty("log4j.configurationFile", "perf-WithoutAnyAppender-location.xml");
System.setProperty("Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
System.setProperty("AsyncLogger.RingBufferSize", "262144");
System.setProperty("AsyncLogger.WaitStrategy", "Yield");
//System.setProperty("log4j2.enable.threadlocals", "true");
//System.setProperty("log4j.format.msg.async", "true");
logger = LogManager.getLogger(getClass());
new File("perftest.log").delete();
}
use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.
the class FormatterLoggerBenchmark method up.
@Setup(Level.Trial)
public void up() {
new File("perftest.log").delete();
System.setProperty("log4j.configurationFile", "perf3PlainNoLoc.xml");
logger = LogManager.getLogger(getClass());
formatterLogger = LogManager.getLogger("formatter", new StringFormatterMessageFactory());
}
use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.
the class AsyncLoggersBenchmark method up.
@Setup(Level.Trial)
public void up() {
System.setProperty("log4j.configurationFile", "perf-WithoutAnyAppender.xml");
System.setProperty("Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
System.setProperty("AsyncLogger.RingBufferSize", "262144");
System.setProperty("AsyncLogger.WaitStrategy", "Yield");
//System.setProperty("log4j2.enable.threadlocals", "true");
//System.setProperty("log4j.format.msg.async", "true");
logger = LogManager.getLogger(getClass());
new File("perftest.log").delete();
}
use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.
the class MemoryHandlerJULBenchmark method up.
@Setup(Level.Trial)
public void up() {
memoryHandler = new MemoryHandler(new NoOpJULHandler(), 262144, java.util.logging.Level.SEVERE);
logger = java.util.logging.Logger.getLogger(getClass().getName());
logger.setUseParentHandlers(false);
logger.addHandler(memoryHandler);
logger.setLevel(java.util.logging.Level.ALL);
}
use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.
the class ThreadContextBenchmark method setup.
@Setup
public void setup() {
System.setProperty("log4j2.threadContextMap", IMPLEMENTATIONS.get(threadContextMapAlias).getName());
ThreadContextBenchmarkAccess.init();
injector = ContextDataInjectorFactory.createInjector();
System.out.println(threadContextMapAlias + ": Injector = " + injector);
reusableContextData = threadContextMapAlias.contains("Array") ? new SortedArrayStringMap() : new OpenHashStringMap<>();
keys = new String[count];
values = new String[count];
final Random r = new Random();
for (int j = 0; j < keys.length; j++) {
final char[] str = new char[KEY_LENGTH];
for (int i = 0; i < str.length; i++) {
str[i] = (char) r.nextInt();
}
keys[j] = new String(str);
values[j] = new String(str);
}
// count
final int PROPERTIES_COUNT = 5;
propertyList = new ArrayList<>(PROPERTIES_COUNT);
for (int j = 0; j < PROPERTIES_COUNT; j++) {
final char[] str = new char[KEY_LENGTH];
for (int i = 0; i < str.length; i++) {
str[i] = (char) r.nextInt();
}
propertyList.add(Property.createProperty(new String(str), new String(str)));
}
// ensure ThreadContext contains values
clearAndPut();
}
Aggregations