The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HeliosX::Logger::HiRes - enhanced, high-resolution logging for Helios applications

SYNOPSIS

 # in a helios.ini file:
 [MyService]
 loggers=HeliosX::Logger::HiRes
 internal_logger=off

 --OR--
 
 # using helios_config_set
 helios_config_set -s MyService -H="*" -p loggers -v HeliosX::Logger::HiRes
 helios_config_set -s MyService -H="*" -p internal_logger -v off 

 # then, use heliosx_logger_hires_search to search the log
 heliosx_logger_hires_search --service=MyService

DESCRIPTION

HeliosX::Logger::HiRes is a Helios::Logger logging class that provides logging with high-resolution timestamp precision with a more normalized database structure. It also provides heliosx_logger_hires_search, a command to view and search for log messages at the command line.

CONFIGURATION

HeliosX::Logger::HiRes must be added to your service using the loggers directive either using the helios_config_set command or in helios.ini.

Additionally, as HeliosX::Logger::HiRes is largely intended to replace the Helios internal logger, once you are sure it is working properly in your installation you should turn off the Helios default logger using the internal_logger=off option.

See the Helios::Configuration page for complete information about the loggers and internal_logger directives.

HeliosX::Logger::HiRes itself can be configured using the options below:

  • log_priority_threshold

    Unlike HeliosX::Logger::Syslog and HeliosX::Logger::Log4perl, HeliosX::Logger::HiRes supports the Helios internal logger's log_priority_threshold option to limit the messages actually being logged to a certain level. Unlike the others, HeliosX::Logger::HiRes is intended to replace rather than augment the Helios internal logger, so most users running HeliosX::Logger::HiRes will most likely turn off the Helios internal logger. Rather than create confusion with a separate threshold option, HeliosX::Logger::HiRes honors the internal logger's built-in log_priority_threshold option.

    The log_priority_threshold value should be an integer matching one of the Helios logging priorities in Helios::LogEntry::Levels:

     Priority Name    Integer Value
     LOG_EMERG        0
     LOG_ALERT        1
     LOG_CRIT         2
     LOG_ERR          3
     LOG_WARNING      4
     LOG_NOTICE       5
     LOG_INFO         6
     LOG_DEBUG        7

    Examples:

     # in helios.ini
     # for all services on this host, log everything but debug messages
     [global]
     log_priority_threshold=6
    
     # at the command line, set all instances of MyService
     # to only log warnings and worse
     helios_config_set -s MyService -H="*" -p log_priority_threshold -v 4
     

IMPLEMENTED METHODS

init()

HeliosX::Logger::HiRes->init() is empty.

logMsg($job, $priority, $message)

The logMsg() method takes a job, priority, and log message and savesthe message to the high-resolution log table in the Helios collective database.

The job parameter should be a Helios::Job object. If the job value is undefined, no jobid is saved with the message.

If the priority parameter is undefined, logMsg() defaults the message's priority to 6 (LOG_INFO).

AUTHOR

Andrew Johnson, <lajandy at cpan dot org>

COPYRIGHT AND LICENSE

Copyright (C) 2015 by Logical Helion, LLC.

This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. See the included LICENSE file for details.

WARRANTY

This software comes with no warranty of any kind.