How to log nutch plugin execution

I am working on creating a special nutch plugin with special requirements.

I found my plugin mentioned in hadoop.log , but that didn't matter.

I added LOG.debug("test") and LOG.info("test2") in different places of my code, and I wrote in log4j.properties

 # Logging for development log4j.logger.org.apache.nutch.parse.html=DEBUG 

My question is: where can I find these messages, I checked hadoop.log but found nothing?

How can I register / track my java code? (I do not use eclipse.)

thanks

+4
source share
2 answers

if your plugin has a class Variable

 public static final Log LOG = LogFactory.getLog(YourClass.class .getName()); 

And your called method has:

 LOG.info("Your Logmessage"); 

And you created your plugin and configured that Nutch uses your plugin when fetching / crawling / ... then the message is logged in the hadoop.log file.

When you built Nutch, does it say that it builds your plugin?

If so, you can check your plugin configuration, which is deployed to NutchHome / runtime / local / conf / nutch-site.xml:

 <property> <name>plugin.includes</name> <value>protocol-http|urlfilter-regex|parse-(html)|yourplugin</value> <description>The plugins which are used in every crawl ordered by call- order</description> </property> 

If your plugin is configured at runtime. If you do not change the rebuild Nutch configuration file. If this does not help, you can give me more information.

0
source

Solved by this code

  import org.slf4j.Logger; import org.slf4j.LoggerFactory; public static final Logger LOG = LoggerFactory.getLogger("org.apache.nutch.parse.html"); 
+1
source

Source: https://habr.com/ru/post/1391212/


All Articles