From 7ae08e2257864dbcf0d435282c36d57f79858500 Mon Sep 17 00:00:00 2001 From: Joe Gallo Date: Mon, 27 Feb 2023 09:53:55 -0500 Subject: [PATCH] Disable ingest-attachment logging (#93878) Co-authored-by: Keith Massey --- docs/changelog/93878.yaml | 5 ++++ gradle/verification-metadata.xml | 10 +++++++ modules/ingest-attachment/build.gradle | 19 +++++++++++-- .../licenses/commons-logging-NOTICE.txt | 5 ---- ...LICENSE.txt => jcl-over-slf4j-LICENSE.txt} | 28 +------------------ .../licenses/jcl-over-slf4j-NOTICE.txt | 0 .../licenses/slf4j-nop-LICENSE.txt | 24 ++++++++++++++++ .../licenses/slf4j-nop-NOTICE.txt | 0 .../src/main/config/log4j2.properties | 11 ++++++++ 9 files changed, 68 insertions(+), 34 deletions(-) create mode 100644 docs/changelog/93878.yaml delete mode 100644 modules/ingest-attachment/licenses/commons-logging-NOTICE.txt rename modules/ingest-attachment/licenses/{commons-logging-LICENSE.txt => jcl-over-slf4j-LICENSE.txt} (89%) create mode 100644 modules/ingest-attachment/licenses/jcl-over-slf4j-NOTICE.txt create mode 100644 modules/ingest-attachment/licenses/slf4j-nop-LICENSE.txt create mode 100644 modules/ingest-attachment/licenses/slf4j-nop-NOTICE.txt create mode 100644 modules/ingest-attachment/src/main/config/log4j2.properties diff --git a/docs/changelog/93878.yaml b/docs/changelog/93878.yaml new file mode 100644 index 000000000000..4f03dfb590c3 --- /dev/null +++ b/docs/changelog/93878.yaml @@ -0,0 +1,5 @@ +pr: 93878 +summary: Disable ingest-attachment logging +area: Ingest Node +type: bug +issues: [] diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 7c685f9a99c0..ba498d2bb5e7 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -3484,6 +3484,11 @@ + + + + + @@ -3529,6 +3534,11 @@ + + + + + diff --git a/modules/ingest-attachment/build.gradle b/modules/ingest-attachment/build.gradle index 7679467de401..09e0184a3571 100644 --- a/modules/ingest-attachment/build.gradle +++ b/modules/ingest-attachment/build.gradle @@ -24,10 +24,21 @@ def versions = [ 'mime4j': '0.8.9' ] +// exclude commons-logging from test dependencies to avoid jar-hell, we use jcl-over-slf4j here +configurations.testRuntimeClasspath { exclude module: 'commons-logging' } + dependencies { - // logging + // take over logging for all dependencies api "org.slf4j:slf4j-api:2.0.6" - api "commons-logging:commons-logging:1.2" + api "org.slf4j:jcl-over-slf4j:2.0.6" + + // route slf4j over log4j + // TODO blocked on https://github.com/elastic/elasticsearch/issues/93714 + // api "org.apache.logging.log4j:log4j-slf4j2-impl:2.19.0" + + // nop all slf4j logging + // workaround for https://github.com/elastic/elasticsearch/issues/93714 + api "org.slf4j:slf4j-nop:2.0.6" // mandatory for tika api "org.apache.tika:tika-core:${versions.tika}" @@ -88,6 +99,10 @@ tasks.named("dependencyLicenses").configure { mapping from: /tika-langdetect-.*/, to: 'tika-langdetect' } +esplugin.bundleSpec.from('config/ingest-attachment') { + into 'config' +} + tasks.named("forbiddenPatterns").configure { exclude '**/*.doc' exclude '**/*.docx' diff --git a/modules/ingest-attachment/licenses/commons-logging-NOTICE.txt b/modules/ingest-attachment/licenses/commons-logging-NOTICE.txt deleted file mode 100644 index 72eb32a90245..000000000000 --- a/modules/ingest-attachment/licenses/commons-logging-NOTICE.txt +++ /dev/null @@ -1,5 +0,0 @@ -Apache Commons CLI -Copyright 2001-2009 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). diff --git a/modules/ingest-attachment/licenses/commons-logging-LICENSE.txt b/modules/ingest-attachment/licenses/jcl-over-slf4j-LICENSE.txt similarity index 89% rename from modules/ingest-attachment/licenses/commons-logging-LICENSE.txt rename to modules/ingest-attachment/licenses/jcl-over-slf4j-LICENSE.txt index d64569567334..2bb9ad240fa0 100644 --- a/modules/ingest-attachment/licenses/commons-logging-LICENSE.txt +++ b/modules/ingest-attachment/licenses/jcl-over-slf4j-LICENSE.txt @@ -1,4 +1,3 @@ - Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -174,29 +173,4 @@ incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/modules/ingest-attachment/licenses/jcl-over-slf4j-NOTICE.txt b/modules/ingest-attachment/licenses/jcl-over-slf4j-NOTICE.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/modules/ingest-attachment/licenses/slf4j-nop-LICENSE.txt b/modules/ingest-attachment/licenses/slf4j-nop-LICENSE.txt new file mode 100644 index 000000000000..508a27283f65 --- /dev/null +++ b/modules/ingest-attachment/licenses/slf4j-nop-LICENSE.txt @@ -0,0 +1,24 @@ +Copyright (c) 2004-2007 QOS.ch +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + diff --git a/modules/ingest-attachment/licenses/slf4j-nop-NOTICE.txt b/modules/ingest-attachment/licenses/slf4j-nop-NOTICE.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/modules/ingest-attachment/src/main/config/log4j2.properties b/modules/ingest-attachment/src/main/config/log4j2.properties new file mode 100644 index 000000000000..92951ec9e0e5 --- /dev/null +++ b/modules/ingest-attachment/src/main/config/log4j2.properties @@ -0,0 +1,11 @@ +logger.org_apache_pdfbox.name = org.apache.pdfbox +logger.org_apache_pdfbox.level = off + +logger.org_apache_poi.name = org.apache.poi +logger.org_apache_poi.level = off + +logger.org_apache_fontbox.name = org.apache.fontbox +logger.org_apache_fontbox.level = off + +logger.org_apache_xmlbeans.name = org.apache.xmlbeans +logger.org_apache_xmlbeans.level = off