Uploaded image for project: 'Nutch'
  1. Nutch
  2. NUTCH-163

LogFormatter design

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • 0.8
    • None
    • None
    • All platforms

    Description

      In Nutch project LogFormatter has duplicated functionality:
      1) Logger records format and
      2) Severe error handler

      The first usage is standard and usually could be overwritten by a user of the package by modifying logging.properties file.
      The second usage is much more problematic because it affects the behavior of the whole application (not only Nutch package). To support the error handling LogFormatter enforce usage of the formatter class by all classes of the whole application which uses Nutch package. This is done by overwriting all the system handlers (class java.util.logging.Handler). This operation prevents the application to use its own log formatter. Also this cause LogFormatter.hasLoggedSevere() to be sensitive to all severe records in the big system but not only to relevant. More than that this flag, LogFormatter.loggedSevere is never cleaned what means if an application had one, even unrelated severe record, tools like Fetcher will never run until the application will be restarted.

      I would like to suggest the following solutions:
      1) To separate the functionality of log formatting and error handling or
      2) Change LogFormatter class to be affected only by nutch package functions

      For my opinion the first solution is much better especially if error handling will be encapsulated for each task. I have found the following usages of LogFormatter.hasLoggedSevere():

      • Fetcher
      • URLFilterChecker
      • ParseSegment
        Unfortunately I'm not familiar enough with the usages above to implement this solution that why I suggest the second one.
        I have rewritten my own implementation of LogFormatter class which is used for more than a year in www.rawsugar.com application.
        I could provide the file but do not know how to attach it to the issue. I hope this change will be accepted by the community.

      Attachments

        1. LogFormatter.java
          4 kB
          Par Daniel Fagerstrohm

        Issue Links

          Activity

            People

              Unassigned Unassigned
              danielf Par Daniel Fagerstrohm
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: