I have the following code for custom syslog server (using Syslog4J) which works on Windows.
final UDPNetSyslogServerConfig udpConfig = new UDPNetSyslogServerConfig();
udpConfig.setPort(Integer.parseInt(port));
udpConfig.setHost(host);
udpConfig.addEventHandler(new Handler());
udpConfig.setUseDaemonThread(false);
SyslogServerIF server = SyslogServer.createInstance(host + port, udpConfig);
server.run();
It listens for the incoming events and invokes handler (method) whenever the event is received.
If I run the same code on Mac, it just comes out. Even if I use a loop to wait for the events, the events are not captured.
while (!stop) {
SyslogUtility.sleep(1000);
}
Even the handler's initialize() method is not invoked on Mac.
What port are you trying to use on Mac?
Is it in conflict with an in-use port (default is 514)?
Check
/etc/syslog.confon MacOS to see what port it is using for the built in syslog. On Ubuntu, this can be found in/etc/rsyslog.conf.