aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache/poi/xslf/usermodel
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/ooxml/java/org/apache/poi/xslf/usermodel
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/ooxml/java/org/apache/poi/xslf/usermodel')
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java11
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFColor.java8
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java11
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java8
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java8
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java8
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPropertiesDelegate.java14
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java18
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java13
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java8
10 files changed, 53 insertions, 54 deletions
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
index 4a355fead0..1f81dc34ee 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
@@ -16,6 +16,7 @@
==================================================================== */
package org.apache.poi.xslf.usermodel;
+import static org.apache.logging.log4j.util.Unbox.box;
import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
import java.awt.Dimension;
@@ -34,6 +35,8 @@ import java.util.OptionalLong;
import java.util.regex.Pattern;
import java.util.stream.Stream;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.ooxml.POIXMLDocument;
import org.apache.poi.ooxml.POIXMLDocumentPart;
import org.apache.poi.ooxml.POIXMLException;
@@ -50,8 +53,6 @@ import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianConsts;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMasterIdList;
@@ -72,7 +73,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.PresentationDocument
@Beta
public class XMLSlideShow extends POIXMLDocument
implements SlideShow<XSLFShape, XSLFTextParagraph> {
- private static final POILogger LOG = POILogFactory.getLogger(XMLSlideShow.class);
+ private static final Logger LOG = LogManager.getLogger(XMLSlideShow.class);
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 1_000_000;
@@ -167,7 +168,7 @@ public class XMLSlideShow extends POIXMLDocument
_presentation.getSldIdLst().getSldIdList().forEach(id -> {
XSLFSlide sh = shIdMap.get(id.getId2());
if (sh == null) {
- LOG.log(POILogger.WARN, "Slide with r:id " + id.getId() + " was defined, but didn't exist in package, skipping");
+ LOG.atWarn().log("Slide with r:id {} was defined, but didn't exist in package, skipping", box(id.getId()));
} else {
_slides.add(sh);
}
@@ -260,7 +261,7 @@ public class XMLSlideShow extends POIXMLDocument
XSLFSlideMaster sm = _masters.get(0);
XSLFSlideLayout layout = sm.getLayout(SlideLayout.BLANK);
if (layout == null) {
- LOG.log(POILogger.WARN, "Blank layout was not found - defaulting to first slide layout in master");
+ LOG.atWarn().log("Blank layout was not found - defaulting to first slide layout in master");
XSLFSlideLayout[] sl = sm.getSlideLayouts();
if (sl.length == 0) {
throw new POIXMLException("SlideMaster must contain a SlideLayout.");
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFColor.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFColor.java
index cafb705a7e..c939383488 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFColor.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFColor.java
@@ -22,6 +22,8 @@ import java.awt.Color;
import javax.xml.namespace.QName;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.ooxml.util.POIXMLUnits;
import org.apache.poi.sl.draw.DrawPaint;
import org.apache.poi.sl.usermodel.AbstractColorStyle;
@@ -29,8 +31,6 @@ import org.apache.poi.sl.usermodel.ColorStyle;
import org.apache.poi.sl.usermodel.PresetColor;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
@@ -50,7 +50,7 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTSystemColor;
@Beta
@Internal
public class XSLFColor {
- private static final POILogger LOGGER = POILogFactory.getLogger(XSLFColor.class);
+ private static final Logger LOGGER = LogManager.getLogger(XSLFColor.class);
private static final QName VAL_ATTR = new QName("val");
private final XmlObject _xmlObject;
@@ -187,7 +187,7 @@ public class XSLFColor {
@Internal
protected void setColor(Color color) {
if (!(_xmlObject instanceof CTSolidColorFillProperties)) {
- LOGGER.log(POILogger.ERROR, "XSLFColor.setColor currently only supports CTSolidColorFillProperties");
+ LOGGER.atError().log("XSLFColor.setColor currently only supports CTSolidColorFillProperties");
return;
}
CTSolidColorFillProperties fill = (CTSolidColorFillProperties)_xmlObject;
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
index 13a4842735..593a4ee1ca 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
@@ -27,14 +27,14 @@ import java.awt.geom.Rectangle2D;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.ooxml.POIXMLTypeLoader;
import org.apache.poi.ooxml.util.POIXMLUnits;
import org.apache.poi.sl.draw.geom.CustomGeometry;
import org.apache.poi.sl.draw.geom.PresetGeometries;
import org.apache.poi.sl.usermodel.FreeformShape;
import org.apache.poi.util.Beta;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
@@ -62,7 +62,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTShapeNonVisual;
public class XSLFFreeformShape extends XSLFAutoShape
implements FreeformShape<XSLFShape,XSLFTextParagraph> {
- private static final POILogger LOG = POILogFactory.getLogger(XSLFFreeformShape.class);
+ private static final Logger LOG = LogManager.getLogger(XSLFFreeformShape.class);
/*package*/ XSLFFreeformShape(CTShape shape, XSLFSheet sheet) {
super(shape, sheet);
@@ -143,8 +143,7 @@ public class XSLFFreeformShape extends XSLFAutoShape
try {
staxReader.close();
} catch (XMLStreamException e) {
- LOG.log(POILogger.WARN,
- "An error occurred while closing a Custom Geometry XML Stream Reader: " + e.getMessage());
+ LOG.atWarn().log("An error occurred while closing a Custom Geometry XML Stream Reader: {}", e.getMessage());
}
return custGeo;
@@ -177,7 +176,7 @@ public class XSLFFreeformShape extends XSLFAutoShape
} else if (ch instanceof CTPath2DClose) {
addClosePath(path);
} else {
- LOG.log(POILogger.WARN, "can't handle path of type "+xo.getClass());
+ LOG.atWarn().log("can't handle path of type {}", xo.getClass());
}
} while (cursor.toNextSibling());
}
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java
index 490908e35c..59109b7e32 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java
@@ -26,6 +26,8 @@ import java.io.IOException;
import javax.xml.namespace.QName;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.ooxml.POIXMLException;
import org.apache.poi.ooxml.util.POIXMLUnits;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
@@ -34,8 +36,6 @@ import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.sl.usermodel.GraphicalFrame;
import org.apache.poi.sl.usermodel.ShapeType;
import org.apache.poi.util.Beta;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlException;
@@ -51,7 +51,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape;
@Beta
public class XSLFGraphicFrame extends XSLFShape implements GraphicalFrame<XSLFShape, XSLFTextParagraph> {
private static final String DRAWINGML_CHART_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
- private static final POILogger LOG = POILogFactory.getLogger(XSLFGraphicFrame.class);
+ private static final Logger LOG = LogManager.getLogger(XSLFGraphicFrame.class);
/*package*/ XSLFGraphicFrame(CTGraphicalObjectFrame shape, XSLFSheet sheet){
super(shape,sheet);
@@ -285,7 +285,7 @@ public class XSLFGraphicFrame extends XSLFShape implements GraphicalFrame<XSLFSh
try {
gs = CTGroupShape.Factory.parse(xo.newDomNode());
} catch (XmlException e) {
- LOG.log(POILogger.WARN, "Can't parse fallback picture stream of graphical frame", e);
+ LOG.atWarn().withThrowable(e).log("Can't parse fallback picture stream of graphical frame");
return null;
}
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java
index 0838d4e929..5cf47873f3 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java
@@ -25,14 +25,14 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.ooxml.POIXMLDocumentPart.RelationPart;
import org.apache.poi.ooxml.util.POIXMLUnits;
import org.apache.poi.sl.draw.DrawPictureShape;
import org.apache.poi.sl.usermodel.GroupShape;
import org.apache.poi.sl.usermodel.PictureData;
import org.apache.poi.util.Beta;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
import org.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties;
@@ -56,7 +56,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
@Beta
public class XSLFGroupShape extends XSLFShape
implements XSLFShapeContainer, GroupShape<XSLFShape,XSLFTextParagraph> {
- private static final POILogger LOG = POILogFactory.getLogger(XSLFGroupShape.class);
+ private static final Logger LOG = LogManager.getLogger(XSLFGroupShape.class);
private final List<XSLFShape> _shapes;
private final CTGroupShapeProperties _grpSpPr;
@@ -396,7 +396,7 @@ implements XSLFShapeContainer, GroupShape<XSLFShape,XSLFTextParagraph> {
} else if (shape instanceof XSLFTable) {
newShape = createTable();
} else {
- LOG.log(POILogger.WARN, "copying of class "+shape.getClass()+" not supported.");
+ LOG.atWarn().log("copying of class {} not supported.", shape.getClass());
continue;
}
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
index 848c8c86c3..9c4fc5902e 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
@@ -35,6 +35,8 @@ import javax.imageio.ImageIO;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.ooxml.util.POIXMLUnits;
import org.apache.poi.ooxml.util.XPathHelper;
import org.apache.poi.openxml4j.opc.PackagePart;
@@ -44,8 +46,6 @@ import org.apache.poi.sl.usermodel.PictureData.PictureType;
import org.apache.poi.sl.usermodel.PictureShape;
import org.apache.poi.sl.usermodel.Placeholder;
import org.apache.poi.util.Beta;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
import org.apache.poi.xslf.draw.SVGImageRenderer;
import org.apache.xmlbeans.XmlCursor;
@@ -70,7 +70,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTPictureNonVisual;
@Beta
public class XSLFPictureShape extends XSLFSimpleShape
implements PictureShape<XSLFShape,XSLFTextParagraph> {
- private static final POILogger LOG = POILogFactory.getLogger(XSLFPictureShape.class);
+ private static final Logger LOG = LogManager.getLogger(XSLFPictureShape.class);
private static final String MS_DML_NS = "http://schemas.microsoft.com/office/drawing/2010/main";
private static final String MS_SVG_NS = "http://schemas.microsoft.com/office/drawing/2016/SVG/main";
@@ -357,7 +357,7 @@ public class XSLFPictureShape extends XSLFSimpleShape
XSLFPictureShape p = (XSLFPictureShape)sh;
String blipId = p.getBlipId();
if (blipId == null) {
- LOG.log(POILogger.WARN, "unable to copy invalid picture shape");
+ LOG.atWarn().log("unable to copy invalid picture shape");
return;
}
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPropertiesDelegate.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPropertiesDelegate.java
index bce5af4d6b..bc1aee7850 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPropertiesDelegate.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPropertiesDelegate.java
@@ -17,9 +17,9 @@
package org.apache.poi.xslf.usermodel;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.util.Internal;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties;
@@ -50,9 +50,9 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperti
*/
@Internal
/* package */ class XSLFPropertiesDelegate {
- private static final POILogger LOG = POILogFactory.getLogger(XSLFPropertiesDelegate.class);
+ private static final Logger LOG = LogManager.getLogger(XSLFPropertiesDelegate.class);
+
-
public static XSLFFillProperties getFillDelegate(XmlObject props) {
return getDelegate(XSLFFillProperties.class, props);
}
@@ -1848,15 +1848,15 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperti
} else if (props instanceof CTTextCharacterProperties) {
obj = new TextCharDelegate((CTTextCharacterProperties)props);
} else {
- LOG.log(POILogger.ERROR, props.getClass(), " is an unknown properties type");
+ LOG.atError().log("{} is an unknown properties type", props.getClass());
return null;
}
if (clazz.isInstance(obj)) {
return (T)obj;
}
-
- LOG.log(POILogger.WARN, obj.getClass() +" doesn't implement "+ clazz);
+
+ LOG.atWarn().log("{} doesn't implement {}", obj.getClass(), clazz);
return null;
}
}
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
index 59945d51db..1364cd7228 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
@@ -16,10 +16,10 @@
==================================================================== */
package org.apache.poi.xslf.usermodel;
+import static org.apache.logging.log4j.util.Unbox.box;
import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
+import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.InputStream;
@@ -33,6 +33,8 @@ import java.util.Map;
import javax.xml.namespace.QName;
import com.zaxxer.sparsebits.SparseBitSet;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.ooxml.POIXMLDocumentPart;
import org.apache.poi.ooxml.POIXMLException;
import org.apache.poi.openxml4j.opc.OPCPackage;
@@ -50,8 +52,6 @@ import org.apache.poi.sl.usermodel.Sheet;
import org.apache.poi.util.Beta;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
import org.apache.poi.xddf.usermodel.chart.XDDFChart;
import org.apache.xmlbeans.XmlCursor;
@@ -73,7 +73,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
@Beta
public abstract class XSLFSheet extends POIXMLDocumentPart
implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph> {
- private static POILogger LOG = POILogFactory.getLogger(XSLFSheet.class);
+ private static Logger LOG = LogManager.getLogger(XSLFSheet.class);
private XSLFDrawing _drawing;
private List<XSLFShape> _shapes;
@@ -122,7 +122,7 @@ implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph> {
@SuppressWarnings("WeakerAccess")
protected void registerShapeId(final int shapeId) {
if (shapeIds.get(shapeId)) {
- LOG.log(POILogger.WARN, "shape id "+shapeId+" has been already used.");
+ LOG.atWarn().log("shape id {} has been already used.", box(shapeId));
}
shapeIds.set(shapeId);
}
@@ -130,7 +130,7 @@ implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph> {
@SuppressWarnings("WeakerAccess")
protected void deregisterShapeId(final int shapeId) {
if (!shapeIds.get(shapeId)) {
- LOG.log(POILogger.WARN, "shape id "+shapeId+" hasn't been registered.");
+ LOG.atWarn().log("shape id {} hasn't been registered.", box(shapeId));
}
shapeIds.clear(shapeId);
}
@@ -168,7 +168,7 @@ implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph> {
CTGroupShape grp = CTGroupShape.Factory.parse(cur.newXMLStreamReader());
shapes.addAll(buildShapes(grp, parent));
} catch (XmlException e) {
- LOG.log(POILogger.DEBUG, "unparsable alternate content", e);
+ LOG.atDebug().withThrowable(e).log("unparsable alternate content");
}
}
cur.pop();
@@ -726,7 +726,7 @@ implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph> {
* @since POI 4.1.0
*/
public void addChart(XSLFChart chart) {
- Rectangle2D rect2D = new java.awt.Rectangle(XDDFChart.DEFAULT_X, XDDFChart.DEFAULT_Y,
+ Rectangle2D rect2D = new Rectangle(XDDFChart.DEFAULT_X, XDDFChart.DEFAULT_Y,
XDDFChart.DEFAULT_WIDTH, XDDFChart.DEFAULT_HEIGHT);
this.addChart(chart, rect2D);
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
index 0f4448a3af..f7424d1807 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
@@ -25,6 +25,8 @@ import java.awt.geom.Rectangle2D;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.ooxml.util.POIXMLUnits;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.sl.draw.DrawPaint;
@@ -44,8 +46,6 @@ import org.apache.poi.sl.usermodel.StrokeStyle.LineCap;
import org.apache.poi.sl.usermodel.StrokeStyle.LineCompound;
import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
import org.apache.poi.util.Beta;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
import org.apache.poi.xslf.model.PropertyFetcher;
import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFEffectProperties;
@@ -61,7 +61,7 @@ import org.openxmlformats.schemas.drawingml.x2006.main.*;
public abstract class XSLFSimpleShape extends XSLFShape
implements SimpleShape<XSLFShape,XSLFTextParagraph> {
private static final CTOuterShadowEffect NO_SHADOW = CTOuterShadowEffect.Factory.newInstance();
- private static final POILogger LOG = POILogFactory.getLogger(XSLFSimpleShape.class);
+ private static final Logger LOG = LogManager.getLogger(XSLFSimpleShape.class);
/* package */XSLFSimpleShape(XmlObject shape, XSLFSheet sheet) {
super(shape,sheet);
@@ -115,7 +115,7 @@ public abstract class XSLFSimpleShape extends XSLFShape
return ((CTShapeProperties)xo).addNewXfrm();
} else {
// ... group shapes have their own getXfrm()
- LOG.log(POILogger.WARN, getClass() +" doesn't have xfrm element.");
+ LOG.atWarn().log("{} doesn't have xfrm element.", getClass());
return null;
}
}
@@ -715,8 +715,7 @@ public abstract class XSLFSimpleShape extends XSLFShape
staxReader.close();
}
catch (XMLStreamException e) {
- LOG.log(POILogger.WARN,
- "An error occurred while closing a Custom Geometry XML Stream Reader: " + e.getMessage());
+ LOG.atWarn().log("An error occurred while closing a Custom Geometry XML Stream Reader: {}", e.getMessage());
}
} else {
geom = dict.get("rect");
@@ -1114,7 +1113,7 @@ public abstract class XSLFSimpleShape extends XSLFShape
private static CTLineProperties getLn(XSLFShape shape, boolean create) {
XmlObject pr = shape.getShapeProperties();
if (!(pr instanceof CTShapeProperties)) {
- LOG.log(POILogger.WARN, shape.getClass() +" doesn't have line properties");
+ LOG.atWarn().log("{} doesn't have line properties", shape.getClass());
return null;
}
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
index 930e9abfa3..ea1c179d66 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
@@ -19,6 +19,8 @@ package org.apache.poi.xslf.usermodel;
import java.awt.Color;
import java.util.function.Consumer;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.common.usermodel.fonts.FontCharset;
import org.apache.poi.common.usermodel.fonts.FontFamily;
import org.apache.poi.common.usermodel.fonts.FontGroup;
@@ -33,8 +35,6 @@ import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
import org.apache.poi.sl.usermodel.TextRun;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
import org.apache.poi.xslf.model.CharacterPropertyFetcher;
import org.apache.poi.xslf.model.CharacterPropertyFetcher.CharPropFetcher;
@@ -62,7 +62,7 @@ import org.openxmlformats.schemas.drawingml.x2006.main.STTextUnderlineType;
*/
@Beta
public class XSLFTextRun implements TextRun {
- private static final POILogger LOG = POILogFactory.getLogger(XSLFTextRun.class);
+ private static final Logger LOG = LogManager.getLogger(XSLFTextRun.class);
private final XmlObject _r;
private final XSLFTextParagraph _p;
@@ -114,7 +114,7 @@ public class XSLFTextRun implements TextRun {
@Override
public void setFontColor(PaintStyle color) {
if (!(color instanceof SolidPaint)) {
- LOG.log(POILogger.WARN, "Currently only SolidPaint is supported!");
+ LOG.atWarn().log("Currently only SolidPaint is supported!");
return;
}
SolidPaint sp = (SolidPaint)color;