Skip to content

Commit c33ffcc

Browse files
authored
Merge pull request #11 from albertotn/log
#9 added log using lof4j
2 parents 3272b61 + fef9ec3 commit c33ffcc

File tree

4 files changed

+85
-67
lines changed

4 files changed

+85
-67
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
log4j.rootCategory=debug,console
2+
log4j.logger=debug,console
3+
4+
log4j.appender.console=org.apache.log4j.ConsoleAppender
5+
log4j.appender.console.target=System.out
6+
log4j.appender.console.immediateFlush=true
7+
log4j.appender.console.encoding=UTF-8
8+
9+
log4j.appender.console.layout=org.apache.log4j.PatternLayout
10+
log4j.appender.console.layout.conversionPattern=%d [%t] %-5p %c - %m%n

pom.xml

Lines changed: 63 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,64 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<modelVersion>4.0.0</modelVersion>
6-
7-
<groupId>org.quickperf</groupId>
8-
<artifactId>maven-test-bench</artifactId>
9-
<version>1.0-SNAPSHOT</version>
10-
11-
<properties>
12-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13-
<maven.compiler.source>1.8</maven.compiler.source>
14-
<maven.compiler.target>1.8</maven.compiler.target>
15-
</properties>
16-
17-
<dependencies>
18-
<dependency>
19-
<groupId>org.apache.maven.shared</groupId>
20-
<artifactId>maven-verifier</artifactId>
21-
<version>1.6</version>
22-
<scope>test</scope>
23-
</dependency>
24-
<dependency>
25-
<groupId>org.quickperf</groupId>
26-
<artifactId>quick-perf-junit4</artifactId>
27-
<version>1.0.0-RC4</version>
28-
<scope>test</scope>
29-
</dependency>
30-
<dependency>
31-
<groupId>junit</groupId>
32-
<artifactId>junit</artifactId>
33-
<version>4.12</version>
34-
<scope>test</scope>
35-
</dependency>
36-
<dependency>
37-
<groupId>net.lingala.zip4j</groupId>
38-
<artifactId>zip4j</artifactId>
39-
<version>2.1.1</version>
40-
</dependency>
41-
<dependency>
42-
<groupId>commons-io</groupId>
43-
<artifactId>commons-io</artifactId>
44-
<version>2.6</version>
45-
</dependency>
46-
<dependency>
47-
<groupId>org.apache.commons</groupId>
48-
<artifactId>commons-csv</artifactId>
49-
<version>1.7</version>
50-
</dependency>
51-
<dependency>
52-
<groupId>com.github.oshi</groupId>
53-
<artifactId>oshi-core</artifactId>
54-
<version>4.0.0</version>
55-
</dependency>
56-
<dependency>
57-
<!-- To avoid "SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
58-
with oshi-core
59-
-->
60-
<groupId>org.slf4j</groupId>
61-
<artifactId>slf4j-simple</artifactId>
62-
<version>1.7.25</version>
63-
</dependency>
64-
</dependencies>
65-
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.quickperf</groupId>
8+
<artifactId>maven-test-bench</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
<maven.compiler.source>1.8</maven.compiler.source>
14+
<maven.compiler.target>1.8</maven.compiler.target>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.apache.maven.shared</groupId>
20+
<artifactId>maven-verifier</artifactId>
21+
<version>1.6</version>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.quickperf</groupId>
26+
<artifactId>quick-perf-junit4</artifactId>
27+
<version>1.0.0-RC4</version>
28+
<scope>test</scope>
29+
</dependency>
30+
<dependency>
31+
<groupId>junit</groupId>
32+
<artifactId>junit</artifactId>
33+
<version>4.12</version>
34+
<scope>test</scope>
35+
</dependency>
36+
<dependency>
37+
<groupId>net.lingala.zip4j</groupId>
38+
<artifactId>zip4j</artifactId>
39+
<version>2.1.1</version>
40+
</dependency>
41+
<dependency>
42+
<groupId>commons-io</groupId>
43+
<artifactId>commons-io</artifactId>
44+
<version>2.6</version>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.apache.commons</groupId>
48+
<artifactId>commons-csv</artifactId>
49+
<version>1.7</version>
50+
</dependency>
51+
<dependency>
52+
<groupId>com.github.oshi</groupId>
53+
<artifactId>oshi-core</artifactId>
54+
<version>4.0.0</version>
55+
</dependency>
56+
<dependency>
57+
<groupId>org.slf4j</groupId>
58+
<artifactId>slf4j-log4j12</artifactId>
59+
<version>1.7.28</version>
60+
<scope>test</scope>
61+
</dependency>
62+
</dependencies>
63+
6664
</project>

src/test/java/MvnValidateAllocationByMaven3VersionTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import org.quickperf.jvm.annotations.MeasureHeapAllocation;
1212
import org.quickperf.repository.LongFileRepository;
1313
import org.quickperf.repository.ObjectFileRepository;
14+
import org.slf4j.Logger;
15+
import org.slf4j.LoggerFactory;
1416

1517
import java.io.File;
1618
import java.io.FilenameFilter;
@@ -22,6 +24,8 @@
2224
import static org.junit.experimental.results.PrintableResult.testResult;
2325

2426
public class MvnValidateAllocationByMaven3VersionTest {
27+
28+
private Logger logger = LoggerFactory.getLogger(MvnValidateAllocationByMaven3VersionTest.class);
2529

2630
@RunWith(QuickPerfJUnitRunner.class)
2731
public static class MvnValidate {
@@ -71,7 +75,7 @@ public void execute_maven_validate() throws VerificationException {
7175

7276
@Test
7377
public void measure() throws IOException {
74-
78+
logger.debug("measure - start");
7579
String dateTimeAsString = getDateTimeAsString();
7680
String resultFilePath = buildAllocationCsvExportPath(dateTimeAsString);
7781

@@ -98,7 +102,7 @@ public void measure() throws IOException {
98102
}
99103

100104
ExecutionContextTextExporter.INSTANCE.writeExecutionContextToTextFile(dateTimeAsString);
101-
105+
logger.debug("measure - end");
102106
}
103107

104108
private void saveMavenVersion(Maven3Version maven3Version) {

src/test/java/MvnValidateProfilingTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
import org.quickperf.jvm.allocation.AllocationUnit;
88
import org.quickperf.jvm.annotations.HeapSize;
99
import org.quickperf.jvm.annotations.ProfileJvm;
10+
import org.slf4j.Logger;
11+
import org.slf4j.LoggerFactory;
1012

1113
import java.io.IOException;
1214
import java.util.Collections;
1315
import java.util.List;
1416

1517
@RunWith(QuickPerfJUnitRunner.class)
1618
public class MvnValidateProfilingTest {
19+
20+
private Logger logger = LoggerFactory.getLogger(MvnValidateProfilingTest.class);
1721

1822
public static Maven3Version MAVEN_3_VERSION = Maven3Version.V_3_2_5;
1923

@@ -27,7 +31,9 @@ public class MvnValidateProfilingTest {
2731
@HeapSize(value = 6, unit = AllocationUnit.GIGA_BYTE)
2832
@Test
2933
public void execute_maven_validate() throws VerificationException {
34+
logger.debug("execute_maven_validate - start");
3035
verifier.executeGoals(validate);
36+
logger.debug("execute_maven_validate - end");
3137
}
3238

3339
@Before

0 commit comments

Comments
 (0)