enable detailed logging in debug mode
avoid infinite loop in FINEST log level
refactoring for better method reuse