Dain Sundstrom wrote:
On Mar 12, 2006, at 12:30 AM, Lars Kühne wrote:
Like most people these days, I like dependency injection, and this
is what the current code does. Why not stick with it and just change
the current Logger interface a bit (e.g. don't make it a CORBA
object, add isDebugEnabled(), etc.)?
I think projects should avoid logging entirely. The problem with
logging is the information that comes out of it is useless to other
software because it is encoded into user readable strings. IMHO, the
best policy is to use a Monitor. For example see the following XBean
Monitors:
http://svn.apache.org/repos/asf/geronimo/xbean/trunk/xbean-kernel/src/
main/java/org/apache/xbean/kernel/ServiceMonitor.javahttp://
svn.apache.org/repos/asf/geronimo/xbean/trunk/xbean-kernel/src/main/
java/org/apache/xbean/kernel/KernelMonitor.java
These interfaces are incredibly useful when testing, XBean because I
can now have direct access to exceptions and other detailed
information that otherwise would be encoded into a string. For a
normal running server, we will simply convert the monitor events to
(localized) strings and log them using what ever logging system
people want.
Looks nice.
The problem with monitors is they take a lot more thought and effort
to design and code, and I personally don't use them in most cases. I
did in the XBean kernel because I think the kernel interfaces are
critical to the success of the project.
It would be *much* more difficult for an ORB implementation, because the
system is so much bigger than XBean.
For most day to day code, I suggest we create our own Log interface
which is injected into the components.
+1
[...] MX4J has it's own interface which is very close to CL, but it
is easy to work with because you can easily install any implementation.
Yeah, very similar to the Avalon Logger interface OpenORB uses:
http://svn.apache.org/repos/asf/excalibur/trunk/framework/api/src/java/org/apache/avalon/framework/logger/Logger.java
The only thing that is really missing in Avalon is trace(), and maybe we
should allow logging Objects or Serializables instead of Strings.
Lars