|
You're trying to integrate two modules from two different sources. Each module has its own logging approach.
System A:
package com.fubar.log;
public final class Log {
public int INFO=1, WARN=2, ERROR=3, FATAL=4;
public static void setLog(File f) {...}
public static void log(int level, String msg) {...}
}
Calls to Log.log are sprinkled throughout the code.
System B:
package com.bar.logger;
public class Logger {
public void informational(String msg) {...}
public void informational(String msg, Exception e) {...}
public void warning(String msg) {...}
public void warning(String msg, Exception e) {...}
public void fatal(String msg) {...}
public void fatal(String msg, Exception e) {...}
}
public class LogFacility {
public Logger makeLogger(String id) {...}
public static void setOutput(OutputStream out) {...}
}
Objects that may need to log hold a Logger object.
Your long-term goal is to move to the new standard logging facility in JDK 1.4, but your environment doesn't support that yet.
What overall approach would you use to harmonize these classes with where you want to go? (Make sure to address the JDK 1.4 concern.) Create a simple test for each logger, and implement the logger with the simplest approach possible. Harmonize the classes so you can eliminate one of them. (Don't worry about the JDK 1.4 future yet.)
See Appendix A for solutions.
|