...
(pull request also linked)Jira server ASF JIRA serverId 5aa69414-a9e9-3523-82ec-879b028fb15b key NUTCH-2885
Example Logging Syntax
Code Block | ||||
---|---|---|---|---|
| ||||
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
...
public class Injector extends NutchTool implements Tool {
private static final Logger LOG = LoggerFactory
.getLogger(MethodHandles.lookup().lookupClass());
...
@Override
public void setup(Context context) {
...
LOG.info("Injector: overwrite: " + overwrite);
LOG.info("Injector: update: " + update);
} |
Default Configuration
Info | ||
---|---|---|
| ||
Prior to Nutch version 1.19, Nutch logging was configured via conf/log4j.properties this changed in Nutch 1.19... see below |
As of version 1.19 Nutch uses conf/log4j2.xml to define how logging will work for logging configuration. By default, Nutch will log to log to $NUTCH_HOME/logs/hadoop.log
...
Extending Nutch Logging Configuration
Log4j2 provides many Appenders which can be configured to extend Nutch logging. See below for some examples of how this could be done
logzio-log4j2-appender
The Logzio Log4j 2 Appender ships logs to Logzio using HTTPS bulk. It can be configured as follows
Add a dependency to ivy/ivy.xml
Code Block | ||
---|---|---|
| ||
<dependency org="io.logz.log4j2" name="logzio-log4j2-appender" rev="1.0.13" conf="*->master" /> |
Augment the log4j2.xml configuration
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
...
<Configuration status="info" name="Nutch" packages="">
...
<Appenders>
<LogzioAppender name="Logzio">
<addHostname>true</addHostname>
<logzioToken>${insert_your_token_here}</logzioToken>
<logzioType>java</logzioType>
<logzioUrl>https://listener.logz.io:8071</logzioUrl>
</LogzioAppender>
...
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Logzio"/>
...
</Root>
</Loggers>
</Configuration> |