EDOC-1410: improving logging logic