In general, I write a debug log whenever one of my functions is entered, including the parameters.
For instance:
function execute_query($query, $conn_string)
{
$this->log->debug(sprintf('Entering execute_query(query=%s, conn_string=%s)', $query, $conn_string));
//Do Stuff
}
The potential problem that I see is that the parameter could contains private data (e.g. connection string could contain a username and password) and it will be written to the log.
That being said, when developing the application I have the logger set to include the debug level, and I would actually find this helpful. When deploying to production I would expect the level to be set to info or error, and so the username/password would never be written to the log.
Is there a best practice around this?