skip to main content

Internal Objects : Slf4jLogger class (com.iscobol.logger.Slf4jLogger)

Slf4jLogger class (com.iscobol.logger.Slf4jLogger)
The isCOBOL runtime can trace the runtime activity into a log file. There are different trace levels available. Depending on the trace level environment settings, called programs, file i/o and SQL can be included in the trace or discarded. The trace level is set through the property iscobol.tracelevel.
By default the trace is saved to a disk file whose name it’s specified by the configuration property iscobol.logfile. It’s possible to make the runtime send all the trace information to a class tha implements the com.iscobol.logger.Logger interface. In this case it will be a duty of this class to manage the trace by saving it to file or by performing other actions.
The class name must be specified through the configuration property iscobol.logclass. When this property is set, the runtime sends the trace information to the class specified by the property instead of writing the information to the file indicated by the iscobol.logfile property.
Currently there is only one class that implements the com.iscobol.logger.Logger interface; this class is included in the isCOBOL runtime library, it’s named com.iscobol.logger.Slf4jLogger and it’s a bridge to the Self4J logger.
In order to use this class, set:
Example
In the following example we make the isCOBOL runtime send the trace information to the Slf4jLogger class that will produce a log splitted into multiple gzipped files, one per second.
Classpath setting
The following libraries must appear in the Classpath for a correct result:
Note - slf4j and log4j libraries are not distributed along with isCOBOL. They must be downloaded separately from their web sites.
Log4J configuration
A file named log4j.properties must appear in the Classpath. Put the following content into it in order to activate rolling and zipping of the log file:
Note - Refer to Log4J documentation for more information about the above entries and other possible entries.
Runtime
For this example, we’re going to run the isCOBOL I/O performance test, installed along with isCOBOL. You can find it in the isCOBOL installation directory under the sample/io-performance subdirectory.
Run the following command:
If everything was configured correctly, you should find a similar list of files in the current folder:
Note - the file name might be a little different, depeding on the date and time when you ran the test.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left