You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Lyons, Dave" <dl...@insitedata.com> on 2002/07/15 19:56:48 UTC

Migrating from Log4J to JDK 1.4 Logging

The company I am working at has decided to standardize on JDK logging instead of
Log4J (we use Log4J now but will go with the standard).  I need to create a very
lightweight transition wrapper for new apps to be developed so a Log4J migration
to JDK logging is easy (we are using BEA WebLogic and we are concerned they won’t
have official JDK 1.4 support before we release). We have been using Lumberjack
in development so we could use JDK logging under JDK 1.3 (can’t use Lumberjack in
production due to Java licensing).  I saw lots of good discussion in the archives
but I didn’t see an example of what I (think) I need.  I’ll describe my need and
please feel free to direct me in another direction if it is more appropriate.  I
apologize in advance if this exact question was already discussed but I couldn’t
find the correct discussion thread.

We want to minimize code changes in the application code.  We’re fine with
changing the package names in the source code but we hope to avoid any other
changes to the application code (we know config code will completely change). 
Since we know the API we will be logging with in the future we won't need a
common denominator wrapper such as commons-logging.

I see Log4J 1.2 has already extended Priority and Category to Level and Logger
and subclasses of Logger are discouraged.  It looks to me like the main things I
need to add make Log4J “mimic” the JDK Logging API is:
1)	Create a Level subclass that adds the Logging APIs names.
2)	Create my own Logger class so I can add JDK Logging specific method signatures
and then delegate to Log4J’s implementation.  I was thinking of a delegation
strategy instead of inheritance strategy to keep Log4J intact and minimize
customization needs.  I’d also store Log4J’s Logger in my class so I don’t need
to do a lookup of Log4J’s logger each time a message is logged.

Does this sound like a valid plan?  I’m open to suggestions.  I know Log4J is
much more complete and I like it but the decision was already made.

Thanks in advance,

Dave

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>