Allows DB calls to be logged given an environment variable

[#77817952]