Kernel::System::Log

NAME

Kernel::System::Log – global log interface

DESCRIPTION

All log functions.

PUBLIC INTERFACE

new()

create a log object. Do not use it directly, instead use:

    use Kernel::System::ObjectManager;
    local $Kernel::OM = Kernel::System::ObjectManager->new(
        'Kernel::System::Log' => {
            LogPrefix => 'InstallScriptX',  # not required, but highly recommend
        },
    );
    my $LogObject = $Kernel::OM->Get('Kernel::System::Log');

Log()

log something. log priorities are 'debug', 'info', 'notice' and 'error'.

These are mapped to the SysLog priorities. Please use the appropriate priority level:

debug

Debug-level messages; info useful for debugging the application, not useful during operations.

info

Informational messages; normal operational messages – may be used for reporting etc, no action required.

notice

Normal but significant condition; events that are unusual but not error conditions, no immediate action required.

error

Error conditions. Non-urgent failures, should be relayed to developers or administrators, each item must be resolved.

See for more info http://en.wikipedia.org/wiki/Syslog#Severity_levels

    $LogObject->Log(
        Priority => 'error',
        Message  => "Need something!",
    );

GetLogEntry()

to get the last log info back

    my $Message = $LogObject->GetLogEntry(
        Type => 'error', # error|info|notice
        What => 'Message', # Message|Traceback
    );

GetLog()

to get the tmp log data (from shared memory – ipc) in csv form

    my $CSVLog = $LogObject->GetLog();

CleanUp()

to clean up tmp log data from shared memory (ipc)

    $LogObject->CleanUp();

Dumper()

dump a perl variable to log

    $LogObject->Dumper(@Array);

    or

    $LogObject->Dumper(%Hash);
Scroll to Top