David Lyons

Looking for consistent logging between Java and Cobol

Discussion created by David Lyons on Apr 16, 2010
Latest reply on Apr 26, 2010 by Jostein Ulseth

 

Would anyone have insight to a clean way of logging statements consistently in both Java and Cobol based on the requirements below? We use log4j in Java.

 

I thought a solution would be to use print() statements in Blaze so we could log them in Cobol and then use a java StreamMonitor to route messages via log4j to a application file. However, that solution falls apart because it doesn’t stop output from going to Java’s System.out (which is prohibited in our app server environment).

 

Details of what we’re trying to do:

 

  1. We want to instrument our rules which run in both Cobol and Java with log4j-like levels (debug, warn, error…).
  2. It doesn’t look like Cobol supports the event monitor structure, so we’re limited to using print(). Note: we’d only enable during development and very isolated times in production.
  3. Using print() for Cobol logging is problematic on the Java side because we can’t send application messages to the app server’s System.out. Instead, they all need to go to an application-specific log.
  4. Is there a way to stop all print() messages from going to System.out and instead route them a user-defined file?
  5. Ideally, we’d define a logging interface with a concrete Cobol implementation that logs using print() while the Java implementation logs via log4j.

 

If there is an easier or better way to accomplish the logging, please let me know. I’m still pretty new at Blaze so I may be missing something.

 

Thanks in advance.

 

Outcomes