Skip to content

Commit 299b548

Browse files
author
Andre Newman
committed
Initial commit
0 parents  commit 299b548

33 files changed

+807
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.gradle/
2+
/bin/
3+
/build/

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Java Logging Framework Benchmark
2+
An application for testing three different Java logging frameworks:
3+
4+
* Log4j 2
5+
* Logback
6+
* java.util.logging
7+
8+
## Building the Project
9+
This project is build using [Gradle](https://gradle.org/). To build this project, navigate to the project folder and run `gradlew tasks build`.
10+
11+
## Running the Tests
12+
Run the project using the following command:
13+
14+
`gradle run -Dexec.args="<iterations> <events per iteration> <framework> <appender> <sync>"`
15+
16+
The arguments take the following format:
17+
18+
* Iterations: The number of iterations (i.e. loops) to run over the course of the test (this does not include one additional iteration to warm up the JVM).
19+
* Events per iteration: The number of events to generate per iteration.
20+
* Framework: The logging framework to use. This can be `log4j2`, `logback`, or `java.util.logging` for the respective framework. If you wish to use log4j2's asynchronous loggers, use `log4j2-async` instead.
21+
* Appender: The Appender to use when logging. This can be `file`, `syslog-tcp`, `syslog-udp`, or `console` (for testing purposes).
22+
* Sync: Specify `sync` for synchronous Appenders, or `async` for asynchronous Appenders.
23+
24+
Information about the current test will be printed to the console.
25+
26+
### Creating new Tests
27+
If you wish to use a different configuration, add the configuration file to the `src/main/resources/sync` folder. Note that if you want to add an asynchronous test, create a copy with an asynchronous appender and move it to the `src/main/resources/async` folder. The file(s) must follow this naming convention:
28+
29+
`<framework>-<appender>.xml`
30+
31+
Re-run Gradle project and your new configuration should be picked up automatically.

build.gradle

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* This build file was generated by the Gradle 'init' task.
3+
*
4+
* This generated file contains a sample Java Library project to get you started.
5+
* For more details take a look at the Java Libraries chapter in the Gradle
6+
* user guide available at https://docs.gradle.org/3.5/userguide/java_library_plugin.html
7+
*/
8+
9+
// Declare dependency versions
10+
ext.log4j2Version = '2.8.2'
11+
ext.logbackVersion = '1.2.3'
12+
ext.disruptorVersion = '3.3.6'
13+
ext.julToSlf4jVersion = '1.7.25'
14+
15+
apply plugin: 'java-library'
16+
apply plugin: 'application'
17+
mainClassName = "com.loggly.frameworks.java.benchmark.Benchmark"
18+
19+
repositories {
20+
jcenter()
21+
}
22+
23+
dependencies {
24+
// This dependency is exported to consumers, that is to say found on their compile classpath.
25+
api 'org.apache.commons:commons-math3:3.6.1'
26+
27+
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
28+
implementation 'com.google.guava:guava:21.0'
29+
30+
// Project-specific dependencies
31+
// Log4j 2
32+
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4j2Version
33+
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4j2Version
34+
35+
// For Log4j2 Async Logging
36+
compile group: 'com.lmax', name: 'disruptor', version: disruptorVersion
37+
38+
// Logback
39+
compile group: 'ch.qos.logback', name: 'logback-classic', version: logbackVersion
40+
}
41+
42+
run {
43+
systemProperties System.getProperties()
44+
45+
args System.getProperty("exec.args").split()
46+
}

gradle/wrapper/gradle-wrapper.jar

53.5 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Aug 04 09:08:24 EDT 2017
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip

gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

logs/file.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
# file.sh - Count the number of lines in a log file (excluding warmup)
3+
# ./file.sh <path to log file>
4+
5+
sed '/Iteration\s0/d' $1 | wc -l -

settings.gradle

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* This settings file was generated by the Gradle 'init' task.
3+
*
4+
* The settings file is used to specify which projects to include in your build.
5+
* In a single project build this file can be empty or even removed.
6+
*
7+
* Detailed information about configuring a multi-project build in Gradle can be found
8+
* in the user guide at https://docs.gradle.org/3.5/userguide/multi_project_builds.html
9+
*/
10+
11+
/*
12+
// To declare projects as part of a multi-project build use the 'include' method
13+
include 'shared'
14+
include 'api'
15+
include 'services:webservice'
16+
*/
17+
18+
rootProject.name = 'Loggly-BechmarkingJavaLoggingFrameworks2017'

0 commit comments

Comments
 (0)