Improve log formatters

Fixes the following issues:

- SimpleDateFormat is not thread safe, so the shared instance should
  be protected by synchronization.

- Logged exceptions are hidden on low log levels, even if the handler
  is configured to show messages on that level.

- IndexDatabase re-implements printStackTrace() in order to work around
  exceptions not being logged on low log levels.