Support for syslogd logging

Someone asked for syslogd support in VASmalltalk. My own logging framework does not have support for this feature – therefore I sat down and looked around, how this must be implemented.

The standard protocol is defined in rfc3164 and it is based on the UDP networking protocol. I sat down and wrote some code to make this possible.

One should be aware, that rfc3164 does not make sure, that you logging message will be really displayed and logged – due to UDP.

I uploaded the code to vastgoodies.

The code supports default logging instance:

MSKSyslogDevice ClearDefault.
MSKSyslogDevice Default: MSKSyslogDevice new.
MSKSyslogDevice Default
  msgFacility: SyslogMessageFacilities::UserLevelMsg ;
  tagInformation: 'VA' ;
  connectTo: 'video'.
MSKSyslogDevice
  DefaultSendSingleMessage: 'First error has occured' severity: SyslogMessageSeverities::Error  id: 'Main' ;
  DefaultSendSingleMessage: 'Second error has occured' severity: SyslogMessageSeverities::Error  id: 'Close'.
MSKSyslogDevice ClearDefault.

Another way is to send a single message. Here a new instance will be created and you have to give it all information to the method, which are needed to deliver the message to the log server:

MSKSyslogDevice
  SendSingleMessage: ('Hallo from Smalltalk ', (DateAndTime now printString) )
  to: 'video'
  facility: SyslogMessageFacilities::UserLevelMsg
  severity: SyslogMessageSeverities::Error
  tag: 'VA'
  id: 'test'.
This entry was posted in Smalltalk. Bookmark the permalink.