Attempt to use sessions only when they are enabled
Properly initialize logging

We need to call APLOG_USE_MODULE() so that the module name is reported
properly in log lines, and per module logging level can be set.

Fixes #6