Good big change

- Introduce logging API
- use AF_UNIX socket as locking object since fcntl doesn't work for /tmp