You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/02/21 20:26:00 UTC
DO NOT REPLY [Bug 27135] New: -
SimpleLog log method should defer writing for better reuse!
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=27135>.
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=27135
SimpleLog log method should defer writing for better reuse!
Summary: SimpleLog log method should defer writing for better
reuse!
Product: Commons
Version: 1.0 Alpha
Platform: Other
OS/Version: Other
Status: NEW
Severity: Enhancement
Priority: Other
Component: Logging
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: arh14@cornell.edu
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 :(
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org