Skip to content

Commit

Permalink
Merge pull request #11 from albertotn/log
Browse files Browse the repository at this point in the history
#9 added log using lof4j
  • Loading branch information
jeanbisutti authored Oct 21, 2019
2 parents 3272b61 + fef9ec3 commit c33ffcc
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 67 deletions.
10 changes: 10 additions & 0 deletions b/src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
log4j.rootCategory=debug,console
log4j.logger=debug,console

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.out
log4j.appender.console.immediateFlush=true
log4j.appender.console.encoding=UTF-8

log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.conversionPattern=%d [%t] %-5p %c - %m%n
128 changes: 63 additions & 65 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,66 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.quickperf</groupId>
<artifactId>maven-test-bench</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-verifier</artifactId>
<version>1.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.quickperf</groupId>
<artifactId>quick-perf-junit4</artifactId>
<version>1.0.0-RC4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<!-- To avoid "SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
with oshi-core
-->
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version>
</dependency>
</dependencies>

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.quickperf</groupId>
<artifactId>maven-test-bench</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-verifier</artifactId>
<version>1.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.quickperf</groupId>
<artifactId>quick-perf-junit4</artifactId>
<version>1.0.0-RC4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.28</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
8 changes: 6 additions & 2 deletions src/test/java/MvnValidateAllocationByMaven3VersionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.quickperf.jvm.annotations.MeasureHeapAllocation;
import org.quickperf.repository.LongFileRepository;
import org.quickperf.repository.ObjectFileRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FilenameFilter;
Expand All @@ -22,6 +24,8 @@
import static org.junit.experimental.results.PrintableResult.testResult;

public class MvnValidateAllocationByMaven3VersionTest {

private Logger logger = LoggerFactory.getLogger(MvnValidateAllocationByMaven3VersionTest.class);

@RunWith(QuickPerfJUnitRunner.class)
public static class MvnValidate {
Expand Down Expand Up @@ -71,7 +75,7 @@ public void execute_maven_validate() throws VerificationException {

@Test
public void measure() throws IOException {

logger.debug("measure - start");
String dateTimeAsString = getDateTimeAsString();
String resultFilePath = buildAllocationCsvExportPath(dateTimeAsString);

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

ExecutionContextTextExporter.INSTANCE.writeExecutionContextToTextFile(dateTimeAsString);

logger.debug("measure - end");
}

private void saveMavenVersion(Maven3Version maven3Version) {
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/MvnValidateProfilingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
import org.quickperf.jvm.allocation.AllocationUnit;
import org.quickperf.jvm.annotations.HeapSize;
import org.quickperf.jvm.annotations.ProfileJvm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Collections;
import java.util.List;

@RunWith(QuickPerfJUnitRunner.class)
public class MvnValidateProfilingTest {

private Logger logger = LoggerFactory.getLogger(MvnValidateProfilingTest.class);

public static Maven3Version MAVEN_3_VERSION = Maven3Version.V_3_2_5;

Expand All @@ -27,7 +31,9 @@ public class MvnValidateProfilingTest {
@HeapSize(value = 6, unit = AllocationUnit.GIGA_BYTE)
@Test
public void execute_maven_validate() throws VerificationException {
logger.debug("execute_maven_validate - start");
verifier.executeGoals(validate);
logger.debug("execute_maven_validate - end");
}

@Before
Expand Down

0 comments on commit c33ffcc

Please sign in to comment.