Can I set the logging files to be created/maindained in a different folder? [RESOLVED]

I’m using the Webhook Add-on to send submissions to a CRM.
I’d like to keep “Logging” turned on to monitor submissions and eventually troubleshoot any that don’t make into the CRM.
I understand the security issues concerning “Logging” but was wondering if there is a way to change the directory where the log files are kept (wp-content/uploads/gravity_forms/logs), moving it to somewhere where it is not accessible to the general public.

Hello. They are not accessible to the general public, unless someone has the link. The directory should not be indexed. No one can stumble across the log. Have you tried finding is by searching, without knowing the link?

If you want to further protect the logs and the uploads, you can use .htaccess Basic Auth to protect the folders:

Thanks Chris,

I was hoping to be able to do two things…
First, change the directory where they are saved and place them out of reach of anyone probing the server, out of the /public_html/ structure.
Second, I’d like to be able to rename the file (and make it change from time to time, maybe on a monthly basis). I’d like to keep them indefinitely. They might prove useful troubleshooting issues (sometimes it takes a while for the website user to notice a problem and having that log might make it easier to identify what (and if) something happened. And it would make it easier to delete very old logs.
Do you know of any way to control either (or both)?

There are currently no filters to change the name of the log file or the location of them. If you would like to suggest that for inclusion in the future, I recommend adding that to our product roadmap. Click the blue :heavy_plus_sign: in the lower left on this page to add a note for our product team:

The log files are kept indefinitely if logging is left on. The log files are rotated out after they reach some size (I believe 10MB) but they are not deleted unless you deactivate logging.

There is however a filter that lets you do what you want with any potential log message including logging to a different file/location/process. In one environment I had a need to log these messages to error_log where a centralized logging system could filter and generate incidents based on specific message types. See gform_logging_message - Gravity Forms Documentation for more details.

add_filter( 'gform_logging_message', 'gform_debug_logging_stdout', 10, 5 );

function gform_debug_logging_stdout( $message, $message_type, $plugin_setting, $log, $instance ) {
    error_log( $message );
    return false;

Thank you Jamie and Chris,

gform_logging_message will do what I need perfectly.

1 Like