loggerpro
loggerpro copied to clipboard
Wrong Message Priority in UDPSyslogAppender for Several Classes
When sending a message to the logger of several types, a generic Syslog Server receives the wrong priority levels.
log.error('Something', '')` => warning
log.warning('Something'. '') => notice
Info and debug are fine. The problem is in the numeric constants for the Syslog Severity
Here's the official list of syslog severity levels:
[SysLogSeverity]
7=slDebug
6=slInformational
5=slNotice
4=slWarning
3=slError
2=slCritical
1=slAlert
0=slEmergency
I have corrected lines 127 - 138 in LoggerPro.UDPSyslogAppender.pas accordingly for .Warning and .Error:
case pLogItem.LogType of
TLogType.Debug:
FPriority := RFC5424Priority(1, 7);
TLogType.Info:
FPriority := RFC5424Priority(1, 6);
TLogType.Warning:
FPriority := RFC5424Priority(1, 4); // 4 = slWarning
TLogType.Error:
FPriority := RFC5424Priority(1, 3); // 3 = slError
end;
if pLogItem.LogMessage.Contains('Access Violation') then
FPriority := RFC5424Priority(1, 2); // 2 = slCritical
now the log priority levels are sent as expected.
I also set the severity for the Access ViolationMessages to one level above error (critical = 2)