aboutsummaryrefslogtreecommitdiffstats
path: root/src/examples
diff options
context:
space:
mode:
authorMarius Volkhart <mariusvolkhart@apache.org>2021-02-21 20:57:25 +0000
committerMarius Volkhart <mariusvolkhart@apache.org>2021-02-21 20:57:25 +0000
commit259c9967efb354a0feff2a861ac8bd20582b6562 (patch)
treeba76a4f20503d97e77bdf18146d59e00a2369fb9 /src/examples
parent6d10f26718f84591671d7cafdcc009345b9c777e (diff)
downloadpoi-259c9967efb354a0feff2a861ac8bd20582b6562.tar.gz
poi-259c9967efb354a0feff2a861ac8bd20582b6562.zip
[bug-63046] Use Log4j 2 for logging
This removes the POILogger and POILogFactory mechanism for logging. This mechanism was created at a time when the Java landscape looked very different than it does today. Log4j 2 is an Apache Foundation project that is well maintained and is widely regarded as having good performance and capabilities. We use only the Log4j API artifact. This lets application developers choose how they want to capture logging events if at all. Integrations with Log4j 2 Core and Logback are available from the Log4j project. Closes #224 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1886770 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/src/org/apache/poi/examples/hssf/usermodel/Outlines.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/examples/src/org/apache/poi/examples/hssf/usermodel/Outlines.java b/src/examples/src/org/apache/poi/examples/hssf/usermodel/Outlines.java
index b5121448c4..42f1b16fc3 100644
--- a/src/examples/src/org/apache/poi/examples/hssf/usermodel/Outlines.java
+++ b/src/examples/src/org/apache/poi/examples/hssf/usermodel/Outlines.java
@@ -22,12 +22,12 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
/**
* Creates outlines.
@@ -35,13 +35,13 @@ import org.apache.poi.util.POILogger;
public class Outlines implements Closeable {
public static void main(String[] args)
throws IOException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
- POILogger LOGGER = POILogFactory.getLogger(Outlines.class);
+ Logger LOGGER = LogManager.getLogger(Outlines.class);
for (int i=1; i<=13; i++) {
try (Outlines o = new Outlines()) {
String log = (String) Outlines.class.getDeclaredMethod("test" + i).invoke(o);
String filename = "outline" + i + ".xls";
o.writeOut(filename);
- LOGGER.log(POILogger.INFO, filename, " written. ", log);
+ LOGGER.atInfo().log("{} written. {}", filename, log);
}
}
}