diff options
author | Marius Volkhart <mariusvolkhart@apache.org> | 2021-02-21 20:57:25 +0000 |
---|---|---|
committer | Marius Volkhart <mariusvolkhart@apache.org> | 2021-02-21 20:57:25 +0000 |
commit | 259c9967efb354a0feff2a861ac8bd20582b6562 (patch) | |
tree | ba76a4f20503d97e77bdf18146d59e00a2369fb9 /src/resources | |
parent | 6d10f26718f84591671d7cafdcc009345b9c777e (diff) | |
download | poi-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/resources')
-rw-r--r-- | src/resources/integrationtest/log4j2-test.xml | 46 | ||||
-rw-r--r-- | src/resources/test/log4j2-test.xml | 46 |
2 files changed, 92 insertions, 0 deletions
diff --git a/src/resources/integrationtest/log4j2-test.xml b/src/resources/integrationtest/log4j2-test.xml new file mode 100644 index 0000000000..637a19d420 --- /dev/null +++ b/src/resources/integrationtest/log4j2-test.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<Configuration status="WARN" name="console"> + <Appenders> + <Console name="Console" target="SYSTEM_OUT"> + <PatternLayout pattern="%d [%t] %-5p %c - %m%n" /> + </Console> + </Appenders> + <Loggers> + + <!-- Mute notoriously noisy loggers --> + <Logger name="org.apache.poi.poifs.nio.FileBackedDataSource" level="ERROR" /> + <Logger name="org.apache.poi.hdgf.chunks.Chunk" level="FATAL" /> + <Logger name="org.apache.poi.hpsf.CodePageString" level="ERROR" /> + <Logger name="org.apache.poi.hdgf.chunks.ChunkFactory" level="ERROR" /> + <Logger name="org.apache.poi.hslf.model.textproperties.BitMaskTextProp" level="ERROR" /> + <Logger name="org.apache.poi.hslf.usermodel.HSLFTextParagraph" level="ERROR" /> + <Logger name="org.apache.poi.openxml4j.opc.ZipPackage" level="ERROR" /> + <Logger name="org.apache.poi.POIDocument" level="WARN" /> + <Logger name="org.apache.poi.openxml4j.opc.OPCPackage" level="ERROR" /> + <Logger name="org.apache.poi.xssf.usermodel.XSSFWorkbook" level="ERROR" /> + <Logger name="org.apache.poi.hslf.usermodel.HSLFGroupShape" level="WARN" /> + <Logger name="org.apache.poi.hslf.record.Record" level="ERROR" /> + + <!-- Change to DEBUG or another level to get log output --> + <Root level="DEBUG"> + <AppenderRef ref="Console" /> + </Root> + </Loggers> +</Configuration> diff --git a/src/resources/test/log4j2-test.xml b/src/resources/test/log4j2-test.xml new file mode 100644 index 0000000000..4737e9569a --- /dev/null +++ b/src/resources/test/log4j2-test.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<Configuration status="WARN" name="console"> + <Appenders> + <Console name="Console" target="SYSTEM_OUT"> + <PatternLayout pattern="%d [%t] %-5p %c - %m%n" /> + </Console> + </Appenders> + <Loggers> + + <!-- Mute notoriously noisy loggers --> + <Logger name="org.apache.poi.poifs.nio.FileBackedDataSource" level="ERROR" /> + <Logger name="org.apache.poi.hdgf.chunks.Chunk" level="FATAL" /> + <Logger name="org.apache.poi.hpsf.CodePageString" level="ERROR" /> + <Logger name="org.apache.poi.hdgf.chunks.ChunkFactory" level="ERROR" /> + <Logger name="org.apache.poi.hslf.model.textproperties.BitMaskTextProp" level="ERROR" /> + <Logger name="org.apache.poi.hslf.usermodel.HSLFTextParagraph" level="ERROR" /> + <Logger name="org.apache.poi.openxml4j.opc.ZipPackage" level="ERROR" /> + <Logger name="org.apache.poi.POIDocument" level="WARN" /> + <Logger name="org.apache.poi.openxml4j.opc.OPCPackage" level="ERROR" /> + <Logger name="org.apache.poi.xssf.usermodel.XSSFWorkbook" level="ERROR" /> + <Logger name="org.apache.poi.hslf.usermodel.HSLFGroupShape" level="WARN" /> + <Logger name="org.apache.poi.hslf.record.Record" level="ERROR" /> + + <!-- Change to DEBUG or another level to get log output --> + <Root level="OFF"> + <AppenderRef ref="Console" /> + </Root> + </Loggers> +</Configuration> |