CHANGE-709 - Refactor logging infrastructure (continuation)

CHANGE-709 - Refactor logging infrastructure (continuation from earlier changes)
- fix chicken/egg problem with log initialization
- add explicit logging messages in more places
- relocate log-delete code to logwriter
<a href='#crh-start'></a><a href='#crh-data-
The reason for isolating the db tests into a separate phpunit.xml was because they require a lot of setup by the unittester, i.e creating a db and  connection parameters.
btw don;t disagree that in the normal unit tests, we should mock the $db. One reason for doing the functional db testing with a live db connection is to tick some boxes on our PA-DSS certification.