Skip to main content

jlog – jlog-Formatted Logging

Last updated March 2020

jlog-formatted logs are binary logs with independent producers, which write the logs, and subscribers, which consume the logs. Momentum jlogs present themselves as directories in the filesystem.

Momentum produces jlogs in the following:


We expressly recommend against writing jlogs to an NFS file system because of concerns about its performance in general and its reliability, especially on Linux.


This module is loaded automatically as required and does not need to be explicitly included.


If your system is generating jlogs, ensure that they are being consumed. Otherwise, the /var/log/ecelerity partition will become exceedingly large. jlog Executable Commands

The following executable commands are used for analyzing and maintaining jlog files:

Using JLog::Reader

Using the JLog::Reader module that ships with Momentum, you can read your jlog files with a Perl script. This module is found in the /opt/msys/3rdParty/lib/perl5/vendor_perl/5.16.3/x86_64-linux-thread-multi/JLog directory on any Momentum node.

A common use case is to process the jlog files created by a custom_logger module. In “custom_logger”, a jlog is created at /var/log/ecelerity/delivery_log_rt with a subscriber name my_subscriber.

custom_logger "custom_logger_jlog" {
  # custom logging in jlog format
  delivery_logfile = "jlog://var/log/ecelerity/delivery_log_rt=>my_subscriber"
  delivery_format = "%t@%r@%R@%vctx_mess{customerid}"

You can read the jlog in the following way:

use JLog::Reader;
my $path = "/var/log/ecelerity/delivery_log_rt";
my $subscriber = "my_subscriber";

my $reader = JLog::Reader->new($path);

while (my $line = $reader->read) {
  # Do something with $line such as process and push into a database
# If you're done with the various $line's or they were pushed to a db
# successfully set a checkpoint.
# if you're done with reading the log, close it

This code opens a jlog and reads each line in that jlog. The $path and $subscriber variables should match those configured in the custom_logger module. The checkpoint method indicates that records have been read successfully to this point. Records are removed after they have been read by all registered subscribers.

For more information about JLog::Reader, issue the command /opt/msys/3rdParty/bin/perldoc JLog::Reader .

Was this page helpful?