Implement logdir support on Linux and Mac OS X.