[ http://issues.apache.org/jira/browse/LOGGING-86?page=all ]
Dennis Lundberg updated LOGGING-86: ----------------------------------- Bugzilla Id: (was: 27135) Affects Version/s: 1.0.3 (was: 1.0 Alpha) > [logging] SimpleLog log method should defer writing for better reuse! > --------------------------------------------------------------------- > > Key: LOGGING-86 > URL: http://issues.apache.org/jira/browse/LOGGING-86 > Project: Commons Logging > Issue Type: Improvement > Affects Versions: 1.0.3 > Environment: Operating System: other > Platform: Other > Reporter: Aaron Hamid > Priority: Minor > > SimpleLog 'log' method which performs the actual log write to System.err > should > be refactored to instead call a 'doWrite' method which commits the log > message > to the stream. This would allow subclasses to reuse the bulk of the > SimpleLog > logic but direct the output elsewhere (in my case, for instance, a GUI log > window). This change is too trivial to mandate a full patch, here is a > pseudo > patch: > /** > * <p> Do the actual logging. > * This method assembles the message > * and then prints to <code>System.err</code>.</p> > */ > protected void log(int type, Object message, Throwable t) { > ... > // print to System.err > - System.err.println(buf.toString()); > + doWrite(buf); > } > + /** Subclasses can easily override this */ > + protected void doWrite(StringBuffer buf) { > + System.err.println(buf); > + } > Without this patch, the only current solution is reuse by cutting-and-pasting > the entire 'log' method and changing the single System.err line :( -- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]