Skip to content

Commit

Permalink
[PAXLOGGING-311] Testing memory issues with additional logging APIs
Browse files Browse the repository at this point in the history
(cherry picked from commit f620eaa)
  • Loading branch information
grgrzybek committed May 4, 2020
1 parent a67324f commit feebe09
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.ops4j.pax.exam.OptionUtils.combine;

Expand Down Expand Up @@ -64,15 +62,33 @@ public void memoryIssues() throws IOException {
}

private static class MyClass {
private Logger nonStaticLogger;
private final String name;

public MyClass(String name) {
this.nonStaticLogger = LoggerFactory.getLogger(name);
this.name = name;
}

public void run() {
// running a method
nonStaticLogger.trace("Hello!");
org.slf4j.Logger slf4jLogger = org.slf4j.LoggerFactory.getLogger(name);
slf4jLogger.trace("TRACE through SLF4J");

org.apache.commons.logging.Log commonsLogger = org.apache.commons.logging.LogFactory.getLog(name);
commonsLogger.trace("TRACE through Apache Commons Logging");

org.apache.juli.logging.Log juliLogger = org.apache.juli.logging.LogFactory.getLog(name);
juliLogger.trace("TRACE through JULI Logging");

org.apache.avalon.framework.logger.Logger avalonLogger = org.ops4j.pax.logging.avalon.AvalonLogFactory.getLogger(name);
avalonLogger.debug("DEBUG through Avalon Logger API");

org.jboss.logging.Logger jbossLogger = org.jboss.logging.Logger.getLogger(name);
jbossLogger.trace("TRACE through JBoss Logging Logger API");

org.apache.log4j.Logger log4j1Logger = org.apache.log4j.Logger.getLogger(name);
log4j1Logger.trace("TRACE through Log41 v2 API");

org.apache.logging.log4j.Logger log4j2Logger = org.apache.logging.log4j.LogManager.getLogger(name);
log4j2Logger.trace("TRACE through Log4J v2 API");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.ops4j.pax.exam.OptionUtils.combine;

Expand Down Expand Up @@ -64,15 +62,33 @@ public void memoryIssues() throws IOException {
}

private static class MyClass {
private Logger nonStaticLogger;
private final String name;

public MyClass(String name) {
this.nonStaticLogger = LoggerFactory.getLogger(name);
this.name = name;
}

public void run() {
// running a method
nonStaticLogger.trace("Hello!");
org.slf4j.Logger slf4jLogger = org.slf4j.LoggerFactory.getLogger(name);
slf4jLogger.trace("TRACE through SLF4J");

org.apache.commons.logging.Log commonsLogger = org.apache.commons.logging.LogFactory.getLog(name);
commonsLogger.trace("TRACE through Apache Commons Logging");

org.apache.juli.logging.Log juliLogger = org.apache.juli.logging.LogFactory.getLog(name);
juliLogger.trace("TRACE through JULI Logging");

org.apache.avalon.framework.logger.Logger avalonLogger = org.ops4j.pax.logging.avalon.AvalonLogFactory.getLogger(name);
avalonLogger.debug("DEBUG through Avalon Logger API");

org.jboss.logging.Logger jbossLogger = org.jboss.logging.Logger.getLogger(name);
jbossLogger.trace("TRACE through JBoss Logging Logger API");

org.apache.log4j.Logger log4j1Logger = org.apache.log4j.Logger.getLogger(name);
log4j1Logger.trace("TRACE through Log41 v2 API");

org.apache.logging.log4j.Logger log4j2Logger = org.apache.logging.log4j.LogManager.getLogger(name);
log4j2Logger.trace("TRACE through Log4J v2 API");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@
import java.io.IOException;
import java.util.UUID;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.ops4j.pax.exam.OptionUtils.combine;

Expand Down Expand Up @@ -66,15 +63,33 @@ public void memoryIssues() throws IOException {
}

private static class MyClass {
private Logger nonStaticLogger;
private final String name;

public MyClass(String name) {
this.nonStaticLogger = LoggerFactory.getLogger(name);
this.name = name;
}

public void run() {
// running a method
nonStaticLogger.trace("Hello!");
org.slf4j.Logger slf4jLogger = org.slf4j.LoggerFactory.getLogger(name);
slf4jLogger.trace("TRACE through SLF4J");

org.apache.commons.logging.Log commonsLogger = org.apache.commons.logging.LogFactory.getLog(name);
commonsLogger.trace("TRACE through Apache Commons Logging");

org.apache.juli.logging.Log juliLogger = org.apache.juli.logging.LogFactory.getLog(name);
juliLogger.trace("TRACE through JULI Logging");

org.apache.avalon.framework.logger.Logger avalonLogger = org.ops4j.pax.logging.avalon.AvalonLogFactory.getLogger(name);
avalonLogger.debug("DEBUG through Avalon Logger API");

org.jboss.logging.Logger jbossLogger = org.jboss.logging.Logger.getLogger(name);
jbossLogger.trace("TRACE through JBoss Logging Logger API");

org.apache.log4j.Logger log4j1Logger = org.apache.log4j.Logger.getLogger(name);
log4j1Logger.trace("TRACE through Log41 v2 API");

org.apache.logging.log4j.Logger log4j2Logger = org.apache.logging.log4j.LogManager.getLogger(name);
log4j2Logger.trace("TRACE through Log4J v2 API");
}
}

Expand Down

0 comments on commit feebe09

Please sign in to comment.