commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jamie Lawrence" <>
Subject [logging] Logging for J2ME
Date Tue, 15 Apr 2003 11:38:33 GMT
Hi all,
now I admit that J2ME applications don't have the same requirements for
logging as your J2EE super-critical server app, but I believe there is
one.  To put this in context, I have a platform for which the majority
of the code will run on version from Java2 to J2ME but currently the
logging is not particularly well abstracted.  I'd like use the Common
Logging api's to provide that abstraction.

(after taking a quick look at the source code) The Commons Logging
veneer only seems to require Java2 for the reflection (etc.) operations
in LogFactory.  The Log interface itself is J2ME compliant.  Currently,
this reflection is used (AFAIK) to discover the constructor
<init>(String) and the method setLogFactory(LogFactory).  Couldn't this
be "discovered" by making Logs implement an interface "LogConfig" with
methods init(String name) and addProperty(Object name, Object value) [or
something to that effect].  Each log would then be created using
Class.forName, Class.newInstance and a no-arg constructor.  The
init(String) and setProperty methods could then be called.

My main rationale for suggesting this is that it is currently not
possible to reimplement a LogFactory style class which does not a) hard
code Log references, b) use reflection.  And hence I can't write a
single LogFactory which spans both J2SE and J2ME.  Of course, the above
suggestion does not preclude the use of reflection, it simply allows
alternative style factories to be created and a wider audience for the
commons logging veneer.

Am I missing something or just plain wrong?


Jamie Lawrence
  Research Fellow
  Media Lab Europe

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message