Syslog4J (syslog) server not starting on Mac

622 Views Asked by At

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.

1

There are 1 best solutions below

0
Splaktar On

What port are you trying to use on Mac?

Is it in conflict with an in-use port (default is 514)?

Check /etc/syslog.conf on MacOS to see what port it is using for the built in syslog. On Ubuntu, this can be found in /etc/rsyslog.conf.