You can also use the same facilities that the debugLog service uses and get the automatic log rolling, etc. without introducing another logging facility (for some reason, I object to adding log4j to IS–it seems redundant).
ServerAPI.getLogStream will return an open stream that can be used for logging. You can do some simple management to have one or more app log streams available.
getLogStream - Wrapper service for ServerAPI.getLogStream. Given an input logfile parm, opens a log file in the server’s default log directory. The returned stream is intended to remain open for the life of the JVM. The service maintains a static hashtable of log streams keyed by the logfile parameter (a filename) on the shared code tab.
writeLogStream - Accepts a stream returned by getLogStream and a message to write. Writes date/time first, followed by the message and then by line.separator.
closeLogStream - Given a logfile, closes the stream associated with it (if any) and removes the stream from the list of open streams. This is primarily a convenience method useful during development.
With these base helper services in place, then you can write app/integration specific service like “logMessage” that calls getLogStream and writeLogStream for a specific logfile name. For example:
writeFooLog(message)
–getLogStream(“foo.log”) → stream
–writeLogStream(stream, message)
log4j certainly provides additional flexibility. The question becomes do you need that flexibility or is just on/off logging sufficient?
Just another option to consider.
#Integration-Server-and-ESB#Flow-and-Java-services#webMethods