Apache Nutch is an extensible and scalable web crawler
NUTCH-2885 Upgrade to Log4j2 (#692)
Lewis John McGibbneye4b7be9bc309
diff --git a/conf/log4j.properties b/conf/log4j.propertiesdeleted file mode 100644index 7b010cbc1..000000000--- a/conf/log4j.properties+++ /dev/null@@ -1,123 +0,0 @@-# 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.--# Define some default values that can be overridden by system properties-hadoop.log.dir=.-hadoop.log.file=hadoop.log--# RootLogger - DailyRollingFileAppender-log4j.rootLogger=INFO,DRFA--# Logging Threshold-log4j.threshold=ALL--#special logging requirements for some commandline tools-log4j.logger.org.apache.nutch.crawl.CrawlDb=INFO,cmdstdout-log4j.logger.org.apache.nutch.crawl.CrawlDbMerger=INFO,cmdstdout-log4j.logger.org.apache.nutch.crawl.CrawlDbReader=INFO,cmdstdout-log4j.logger.org.apache.nutch.crawl.Crawl=INFO,cmdstdout-log4j.logger.org.apache.nutch.crawl.DeduplicationJob=INFO,cmdstdout-log4j.logger.org.apache.nutch.crawl.Generator=INFO,cmdstdout-log4j.logger.org.apache.nutch.crawl.Injector=INFO,cmdstdout-log4j.logger.org.apache.nutch.crawl.LinkDb=INFO,cmdstdout-log4j.logger.org.apache.nutch.crawl.LinkDbMerger=INFO,cmdstdout-log4j.logger.org.apache.nutch.crawl.LinkDbReader=INFO,cmdstdout-log4j.logger.org.apache.nutch.fetcher.Fetcher=INFO,cmdstdout-log4j.logger.org.apache.nutch.fetcher.FetcherItem=INFO,cmdstdout-log4j.logger.org.apache.nutch.fetcher.FetcherItemQueue=INFO,cmdstdout-log4j.logger.org.apache.nutch.fetcher.FetcherItemQueues=INFO,cmdstdout-log4j.logger.org.apache.nutch.fetcher.FetcherThread=INFO,cmdstdout-log4j.logger.org.apache.nutch.fetcher.QueueFeeder=INFO,cmdstdout-log4j.logger.org.apache.nutch.hostdb.UpdateHostDb=INFO,cmdstdout-log4j.logger.org.apache.nutch.hostdb.ReadHostDb=INFO,cmdstdout-log4j.logger.org.apache.nutch.indexer.IndexingFiltersChecker=INFO,cmdstdout-log4j.logger.org.apache.nutch.indexer.IndexingJob=INFO,cmdstdout-log4j.logger.org.apache.nutch.indexer.IndexerOutputFormat=INFO,cmdstdout-log4j.logger.org.apache.nutch.indexwriter.solr.SolrIndexWriter=INFO,cmdstdout-log4j.logger.org.apache.nutch.indexwriter.solr.SolrUtils=INFO,cmdstdout-log4j.logger.org.apache.nutch.exchange.Exchanges=INFO,cmdstdout-log4j.logger.org.apache.nutch.parse.ParserChecker=INFO,cmdstdout-log4j.logger.org.apache.nutch.parse.ParseSegment=INFO,cmdstdout-log4j.logger.org.apache.nutch.plugin.PluginRepository=WARN-log4j.logger.org.apache.nutch.protocol.RobotRulesParser=INFO,cmdstdout-log4j.logger.org.apache.nutch.scoring.webgraph.LinkRank=INFO,cmdstdout-log4j.logger.org.apache.nutch.scoring.webgraph.Loops=INFO,cmdstdout-log4j.logger.org.apache.nutch.scoring.webgraph.ScoreUpdater=INFO,cmdstdout-log4j.logger.org.apache.nutch.scoring.webgraph.WebGraph=INFO,cmdstdout-log4j.logger.org.apache.nutch.scoring.webgraph.NodeDumper=INFO,cmdstdout-log4j.logger.org.apache.nutch.segment.SegmentChecker=INFO,cmdstdout-log4j.logger.org.apache.nutch.segment.SegmentMerger=INFO,cmdstdout-log4j.logger.org.apache.nutch.segment.SegmentReader=INFO,cmdstdout-log4j.logger.org.apache.nutch.service.NutchServer=INFO,cmdstdout-log4j.logger.org.apache.nutch.tools.FreeGenerator=INFO,cmdstdout-log4j.logger.org.apache.nutch.util.domain.DomainStatistics=INFO,cmdstdout-log4j.logger.org.apache.nutch.util.SitemapProcessor=INFO,cmdstdout-log4j.logger.org.apache.nutch.webui.NutchUiServer=INFO,cmdstdout--log4j.logger.org.apache.nutch=INFO-log4j.logger.org.apache.hadoop=WARN-# log mapreduce job messages and counters-log4j.logger.org.apache.hadoop.mapreduce.Job=INFO--#-# Daily Rolling File Appender-#--log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender-log4j.appender.DRFA.File=${hadoop.log.dir}/${hadoop.log.file}--# Rollover at midnight-log4j.appender.DRFA.DatePattern=.yyyy-MM-dd--# 30-day backup-#log4j.appender.DRFA.MaxBackupIndex=30-log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout--# Pattern format: Date LogLevel LoggerName LogMessage-log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n-# Debugging Pattern format: Date LogLevel LoggerName (FileName:MethodName:LineNo) LogMessage-#log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n---#-# stdout-# Add *stdout* to rootlogger above if you want to use this-#--log4j.appender.stdout=org.apache.log4j.ConsoleAppender-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n--#-# plain layout used for commandline tools to output to console-#-log4j.appender.cmdstdout=org.apache.log4j.ConsoleAppender-log4j.appender.cmdstdout.layout=org.apache.log4j.PatternLayout-log4j.appender.cmdstdout.layout.ConversionPattern=%m%n--#-# Rolling File Appender-#--#log4j.appender.RFA=org.apache.log4j.RollingFileAppender-#log4j.appender.RFA.File=${hadoop.log.dir}/${hadoop.log.file}--# Logfile size and and 30-day backups-#log4j.appender.RFA.MaxFileSize=1MB-#log4j.appender.RFA.MaxBackupIndex=30--#log4j.appender.RFA.layout=org.apache.log4j.PatternLayout-#log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n-#log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n\ No newline at end of filediff --git a/conf/log4j2.xml b/conf/log4j2.xmlnew file mode 100644index 000000000..c9a41236d--- /dev/null+++ b/conf/log4j2.xml@@ -0,0 +1,51 @@+<?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="INFO" name="Nutch" packages="">+ <Properties>+ <!-- default values that can be overridden by system properties:+ Note: the script bin/nutch sets these properties from the environment variables+ NUTCH_LOG_DIR and NUTCH_LOGFILE -->+ <Property name="hadoop.log.dir">${sys:hadoop.log.dir:-./logs}</Property>+ <Property name="hadoop.log.file">${sys:hadoop.log.file:-hadoop.log}</Property>+ <Property name="hadoop.log.file">hadoop.log</Property>+ </Properties>+ <Appenders>+ <RollingFile name="RollingFile" fileName="${hadoop.log.dir}/${hadoop.log.file}"+ filePattern="${hadoop.log.dir}/$${date:yyyy-MM}/nutch-%d{yyyy-MM-dd}.log.gz">+ <PatternLayout pattern="%d %p %c{1.} [%t] %m%n" />+ <CronTriggeringPolicy schedule="0 0 0 * * ?"/>+ <DefaultRolloverStrategy>+ <Delete basePath="${hadoop.log.dir}" maxDepth="2">+ <IfFileName glob="*/nutch-*.log.gz" />+ <IfLastModified age="60d" />+ </Delete>+ </DefaultRolloverStrategy>+ </RollingFile>+ <Console name="STDOUT" target="SYSTEM_OUT">+ <PatternLayout pattern="%d %p %c{1.} [%t] %m%n" />+ </Console>+ </Appenders>+ <Loggers>+ <Root level="INFO" additivity="false">+ <AppenderRef ref="RollingFile"/>+ <AppenderRef ref="STDOUT"/>+ </Root>+ <Logger name="org.apache.hadoop" level="WARN" additivity="false">+ <Appender-ref ref="RollingFile" level="WARN" />+ </Logger>+ </Loggers>+</Configuration>diff --git a/ivy/ivy.xml b/ivy/ivy.xmlindex 585a0fa94..9ce230e5d 100644--- a/ivy/ivy.xml+++ b/ivy/ivy.xml@@ -36,14 +36,10 @@</publications><dependencies>- <dependency org="org.slf4j" name="slf4j-api" rev="1.7.30" conf="*->master" />- <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.7.30" conf="*->master" />-- <!--dependency org="log4j" name="log4j" rev="1.2.15" conf="*->default">- <exclude org="javax.jms" name="jms" />- <exclude org="com.sun.jdmk" name="jmxtools" />- <exclude org="com.sun.jmx" name="jmxri" />- </dependency-->+ <dependency org="org.apache.logging.log4j" name="log4j-api" rev="2.14.1" conf="*->master" />+ <dependency org="org.apache.logging.log4j" name="log4j-core" rev="2.14.1" conf="*->master" />+ <dependency org="org.apache.logging.log4j" name="log4j-slf4j-impl" rev="2.14.1" conf="*->master" />+ <dependency org="org.slf4j" name="slf4j-api" rev="1.7.31" conf="*->master" /><dependency org="org.apache.commons" name="commons-lang3" rev="3.11" conf="*->default" /><dependency org="org.apache.commons" name="commons-collections4" rev="4.4" conf="*->master" />@@ -136,6 +132,7 @@<exclude module="jmxtools" /><exclude module="jms" /><exclude module="jmxri" />+ <exclude module="slf4j-log4j12" /><exclude org="com.thoughtworks.xstream" /></dependencies>