Modernizing database legacy

Make the legacy database code to use logging, so we get less noise during unittest reports.