|
I'm seeking some advice here. I have a legacy application with it's
own built in logging system accessed via Common.status(String) and
Common.debug(String). The status method is used to update the
application GUI's status line so the user has some idea of what is
going on, it also emits the String to System.out. The debug message
just emits the String to System.out. Now, I'd like to replace this setup with log4j, however, the pitfall is how do I still let the user know what is going on? I believe I have a couple of choices here: 1) Import log4j only in the Common class, and still allow all code to call the status() and debug(). When status or debug are called, it will inspect the current thread to see which class to pass to the logger and create (or use a mapped) logger accordingly. This would probably be the easiest, but not the correct way of doing it. 2) Replace all Common.status(String) and Common.debug(String) calls with logger.info(String) and logger.debug(String). However, can I create a class that will listen for logger.info(String) calls and then can update the GUI's status accordingly? This, I presume, would be the correct way of doing it - if it is at all possible. 3) Of course, you might have a better approach that I haven't thought of yet. This in-house-only application has a pluggable architecture that accepts three different types of Interface classes, which is why there is a single place for logging. When I wrote it three years ago I was still very early in Java and hadn't learned of the tools available to me just yet. Lately, I've been planning an overhaul of this application and implementing log4j is a high priority. All existing plugins are kept in a central repository, therefore updating them to the new logging mechanism, if necessary, will be easy. Any ideas? Clinton --
| ||||||
- Converting Legacy application to use log4j Clinton Weiss
- Re: Converting Legacy application to use log4j James A. N. Stauffer
- Re: Converting Legacy application to use log... Curt Arnold

