You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by GitBox <gi...@apache.org> on 2021/07/10 19:29:40 UTC
[GitHub] [nutch] lewismc opened a new pull request #692: NUTCH-2885 Upgrade to Log4j2
lewismc opened a new pull request #692:
URL: https://github.com/apache/nutch/pull/692
PR for https://issues.apache.org/jira/browse/NUTCH-2885 ready for review.
I feel that this simplifies the logging configuration with precise XML syntax... ultimately less code which I feel is readable.
The configuration uses a RollingFileAppender with the cron triggering policy configured to trigger every day at midnight. Archives are stored in a directory based on the current year and month. All files under the base directory that match the `*/nutch-*.log.gz` glob and are 60 days old or older are deleted at rollover time. Additionally, we retain the ConsoleAppender configuration so everything is also written to STDOUT.
I was motivated to work on this issue because I am performing a trade study which is evaluating [logz.io](https://logz.io/). Specifically, this will allow configuring nutch to use the [logzio-log4j2-appender](https://github.com/logzio/logzio-log4j2-appender).
Comments welcome.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc commented on pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc commented on pull request #692:
URL: https://github.com/apache/nutch/pull/692#issuecomment-889250671
Anyone able to give this a look?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] sebastian-nagel commented on pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
sebastian-nagel commented on pull request #692:
URL: https://github.com/apache/nutch/pull/692#issuecomment-892426141
Hi @lewismc, yes: the branch is ready to be merged. I've added the change to allow to override log file and folder via Java properties.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc edited a comment on pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc edited a comment on pull request #692:
URL: https://github.com/apache/nutch/pull/692#issuecomment-877705830
I've verified that this patch, with some minor additional configuration, enables me to write logs locally, into logz.io and also into enterprise instance of Splunk. The latter two really help with alerts and notifications if something goes wrong i.e. ParseException.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc edited a comment on pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc edited a comment on pull request #692:
URL: https://github.com/apache/nutch/pull/692#issuecomment-877705830
I've verified that this enables me to write logs locally, into logz.io and also into enterprise instance of Splunk. The latter two really help with alerts and notifications if something goes wrong i.e. ParseException.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] sebastian-nagel commented on a change in pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
sebastian-nagel commented on a change in pull request #692:
URL: https://github.com/apache/nutch/pull/692#discussion_r681894793
##########
File path: conf/log4j2.xml
##########
@@ -0,0 +1,44 @@
+<?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>
+ <Property name="hadoop.log.dir">./logs</Property>
Review comment:
I've already tried the change using this "take system property `hadoop.log.dir` if defined otherwise use `./logs` (cf. [Log4j2 - Property Substitution](https://logging.apache.org/log4j/2.x/manual/configuration.html#PropertySubstitution)): it allows to override the log file name and folder via the properties which are also set by bin/nutch from the environment variables. Does the suggested change look good to you?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc edited a comment on pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc edited a comment on pull request #692:
URL: https://github.com/apache/nutch/pull/692#issuecomment-889250671
Anyone able to give this a look? Thank you
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc commented on pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc commented on pull request #692:
URL: https://github.com/apache/nutch/pull/692#issuecomment-877711886
I put some documentation together for this as well
https://cwiki.apache.org/confluence/display/NUTCH/Logging
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc commented on a change in pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc commented on a change in pull request #692:
URL: https://github.com/apache/nutch/pull/692#discussion_r681858158
##########
File path: conf/log4j2.xml
##########
@@ -0,0 +1,44 @@
+<?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>
+ <Property name="hadoop.log.dir">./logs</Property>
Review comment:
I agree @sebastian-nagel , what action do you want me to take here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] sebastian-nagel commented on a change in pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
sebastian-nagel commented on a change in pull request #692:
URL: https://github.com/apache/nutch/pull/692#discussion_r680982506
##########
File path: conf/log4j2.xml
##########
@@ -0,0 +1,44 @@
+<?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>
+ <Property name="hadoop.log.dir">./logs</Property>
Review comment:
```suggestion
<!-- 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>
```
In addition to staying backward-compatible: it's very handy to "redirect" the `hadoop.log` files of different crawl projects (if it's not rename via `hadoop.log.file`/NUTCH_LOGFILE) into a separate folder defined by NUTCH_LOG_DIR similar to having separate configuration folders defined by NUTCH_CONF_DIR. Note: this works only in local mode.
##########
File path: 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" />
Review comment:
(indentation)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc commented on pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc commented on pull request #692:
URL: https://github.com/apache/nutch/pull/692#issuecomment-877705830
I've verified that this enables me to write logs locally, into logz.io and also into Enterprise instance of Splunk. The latter two really help with alerts and notifications if something goes wrong i.e. ParseException.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc commented on a change in pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc commented on a change in pull request #692:
URL: https://github.com/apache/nutch/pull/692#discussion_r681825788
##########
File path: 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" />
Review comment:
Good catch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc commented on pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc commented on pull request #692:
URL: https://github.com/apache/nutch/pull/692#issuecomment-891931345
Thanks @sebastian-nagel , I addressed the following two isses
* formatting in ivy.xml
* introduced logic for `org.apache.hadoop` classes to only log `WARN` and worse... I agree with you this is much better.
Regarding your comments on HADOOP-12956, I also note following entries in STDOUT
```
log4j:WARN No appenders could be found for logger (org.apache.htrace.core.Tracer).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
```
Does HADOOP-12956 stop us from implementing this and then revisiting it once HADOOP-12956 has been included in a forthcoming Hadoop release?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc commented on pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc commented on pull request #692:
URL: https://github.com/apache/nutch/pull/692#issuecomment-892265738
Thanks for your thoughts @sebastian-nagel
I think this patch is ready to be proposed for merging then... wdyt?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] sebastian-nagel commented on pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
sebastian-nagel commented on pull request #692:
URL: https://github.com/apache/nutch/pull/692#issuecomment-891980973
> for `org.apache.hadoop` classes to only log WARN
+1
Regarding the warning about missing appenders: I've also seen it but only in the logs of the ApplicationMaster and nevertheless the `syslog` file contains log messages obviously written via log4j. So, I don't know whether it's an issue at all and esp. for us because in the ApplicationMaster no Nutch classes are involved.
> Does HADOOP-12956 stop us from implementing this
I do not think so. But looks like the upgrade has no effect in (pseudo)distributed mode and the log4j.properties in `$HADOOP_HOME/etc/hadoop/` (or `/etc/hadoop/conf/`) takes precedence.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc edited a comment on pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc edited a comment on pull request #692:
URL: https://github.com/apache/nutch/pull/692#issuecomment-877705830
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc merged pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc merged pull request #692:
URL: https://github.com/apache/nutch/pull/692
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nutch] lewismc merged pull request #692: NUTCH-2885 Upgrade to Log4j2
Posted by GitBox <gi...@apache.org>.
lewismc merged pull request #692:
URL: https://github.com/apache/nutch/pull/692
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@nutch.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org