commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 27135] - [logging] SimpleLog log method should defer writing for better reuse!
Date Sat, 28 Feb 2004 17:50:47 GMT
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

[logging] SimpleLog log method should defer writing for better reuse!





------- Additional Comments From arh14@cornell.edu  2004-02-28 17:50 -------
Yes, I need to override the logging methods because I am writing a "facade" log
for my application which captures all logging to a graphical window.  As far as
I know the easiest, most portable, way of doing this while still retaining all
the implementation-neutrality of jakarta commons logging is to wrap each Log
with my own application log which captures these messages.  My usage is
something like:

class SomeClass {
  private static final Log log = new MyAppLog(LogFactory.getLog("SomeClass"));
}

class MyAppLog extends SimpleLog {
...
  public void doWrite(StringBuffer buf) {
    // write to my log window
  }
  public void info(String message) {
    super.info(message);
    chainedlog.info(message);
  }
...
}


MyAppLog will then capture all output (nicely formatted since it is a SimpleLog
subclass), but also pass it on to the destination log implementation, be it
Log4j, or jdk 1.4 logging, etc.  (technical note, I could equivalently create my
own custom facade log factory implementation but I think that is a bit of
overkill just to cache MyAppLog instances which will most likely no two will be
instantiated with the same name).

If you have any better idea that using such a facade I'm all ears.  The only
other alternative I see is to write appender implementations in every possible
back-end, to write to my application window...I don't think that is feasible or
desirable.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message