custom log as server log

Hi All,

Currently, we have couple business flows sharing with an IS. We want to log different business flows into different log files instead of all in the server.log.
Can I use FileWriter to accomplish this task? If multiple threads try to append sample log file, will I get exception?
wM debugLog seems handle this well but it only can append logs into ONE assigned server.log and I only can find it uses JournalLogger.log() and don’t know how it can be instantiated with different log files.
Will standard java logging.Handler work on this situation?
Or, should I use Log4J to handle the custom logging?

Thanks for any suggestions!

KJ

Log4J would be a better option .

Log4J would be the best option - a little more work up front, but easier to maintain, modify long-term. There are some examples in the KnowledgeBase area of this website, I believe.

You ‘could’ achieve this with an audit EventManager as well, but just about everyone flips out when they hear that, so pursue other options first. :slight_smile:

If I’m not mistaken, there are also public methods in the IS Java API that can be used to achieve the same behavior as server.log for another custom file.

Hi Reamon,

Can you kindly tell me what is the java API name?
I decompiled flow.class and found debugLog() applies JournalLog private class and its API doesn’t allow us to specify 2nd log file name.
Looks like Log4j will be a easier solution for this task.

Thanks a lot!!

KJ

ServerAPI.getLogStream

The method description has the details on how this stream is managed.

You’ll want to write some helper services to manage access to the stream and a “writeLog” service that uses either a fixed stream (created at package startup for example) or accepts a stream object.

Just another option to consider.

Thanks Reamon!

I’ll try it out!!

KJ