[ http://issues.apache.org/jira/browse/NUTCH-236?page=all ]

Chris A. Mattmann updated NUTCH-236:
------------------------------------

    Attachment: NUTCH-236.Mattmann.060806.patch.txt

Okay a bit late, but as usual with me :-)

This patch implements Jason's suggestion for the following two issues:

1. Move log4j root logger redirection and appender code to common place (moved 
to utility method in org.apache.nutch.parse.ParseUtil)

2. Rename appender before adding it, and make sure it hasn't been added already 
before adding it

Jason's original suggestion was to move the common root logger redirection code 
to LogFormatter in Hadoop, but I neglected to do that in order to keep the code 
base within Nutch and not make this patch span the 2 projects. If there is a 
pressing need to have the utility code within Hadoop however, I can probably 
move the method to LogFormatter in Hadoop. Additionally, I just ran unit-level 
tests on this, I didn't run a full system test in an arena where the behavior 
that caused this issue has been seen already. It would be great if someone like 
Jason could test this in his own environment and see if it fixes the issue.



> PdfParser and RSSParser Log4j appender redirection
> --------------------------------------------------
>
>          Key: NUTCH-236
>          URL: http://issues.apache.org/jira/browse/NUTCH-236
>      Project: Nutch
>         Type: Bug

>     Versions: 0.8-dev
>  Environment: Linux, Nutch embedded in an other application
>     Reporter: Jason Calabrese
>     Assignee: Chris A. Mattmann
>     Priority: Minor
>  Attachments: NUTCH-236.Mattmann.060806.patch.txt
>
> I just found a bug in the way the log messages from Hadoop LogFormatter are 
> added as a new appender to the Log4j rootLogger in the PdfParser and 
> RSSParser.
> Since a new Log4j appender is created and added to the root logger each time 
> these classes are loaded log messages start getting repeated.
> I'm using Nutch/Hadoop inside an other application so other may not be seeing 
> this problem.
> I think the simple fix is as easy as setting a name for the new appender 
> before adding it and then at the begining of the constructor checking to see 
> if it's already been added.
> Also as the comment says in both the PdfParser and RSSParser this code should 
> be moved to a common place.
> I'd be happy to make these changes and submit a patch, but I wanted to know 
> it 
> the change would be welcome first.  Also does anyone know a good place for 
> the new util method?  Maybe a new static method on LogFormatter, but then the 
> log4j jar would need to be added to the to the common lib and the classpath.
> It would also be good to create a property in nutch-site.xml that could 
> disable this logging appender redirection.
> Like I said above I'd be more than happy to do this work, I'll just need some 
> guidance to follow the project's conventions.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to