My project aims at reading log messages directly from /dev/log
UNIX domain socket in Java. Currently I am using junixsocket. Below is a sample code of client that r
Since you cannot connect to an existing server socket as mentioned in the log traces, then you haven't bound one one the mentioned file, so try creating an AF_UNIX server socket then connect to it.
It could be done in a separate class:
public class DevLogServer {
public static void main(String[] args) throws IOException {
final File socketFile = new File("/dev/log");
AFUNIXServerSocket server = AFUNIXServerSocket.newInstance();
try {
server.bind(new AFUNIXSocketAddress(socketFile));
} catch (Exception e) {
throw e;
}
}
}
You may also need to make sure the syslod
daemon is stopped by runnig below command in a terminal window:
sudo service syslog stop
You may alternatively need to grand write permission to the /dev directory.