DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18076>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18076

slight improvement in OnlyOnceErrorHandler

           Summary: slight improvement in OnlyOnceErrorHandler
           Product: Log4j
           Version: 1.2
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Other
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


In OnlyOnceErrorHandler you have code that is like

  public 
  void error(String message) {
    if(firstTime) {
      LogLog.error(message);
      firstTime = false;
    }
  }

The first time flag is set to indicate that no further error messages should be
logged.

It would be more robust to write the code like

  public 
  void error(String message) {
    if(firstTime) {
      firstTime = false;
      LogLog.error(message);
    }
  }

Setting first time to be false, and then logging the error.

I have a situation in which we are redirecting all output on stdout and stderr
to the logger. 

The problem is that since I redirect all output from stdout and stderr to the
log, if there is an error in the logger I get an infinite loop, since LogLog
writes its error to stderr (which is logged, which causes an error, which is
written to LogLog, which writes to stderr (which is logged....))

Its minor and trivial.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to