altered constructor so that logging becomes available earlier