WS Form includes an optional license activity log that records every significant interaction with the license server. This includes activations, deactivations, remote checks, and most importantly, every time the license status is cleared or set to inactive.
Logging is disabled by default and has no effect on live sites unless explicitly enabled. If it fails for any reason (such as incorrect file permissions), it does so silently without producing errors or affecting your site.
When to use this feature
Enable logging when you need to diagnose why a license is being deactivated unexpectedly. Common scenarios where this helps:
- The license activates successfully but later shows as unlicensed for no apparent reason
- You are using a
WSF_LICENSE_KEYconstant inwp-config.phpand the key keeps being cleared - Remote API requests to the license server are failing due to hosting firewall rules, network restrictions, or SSL verification issues. The log will capture the exact error returned
- You suspect a cron job or third-party plugin is triggering a license check at an unexpected time
Note: Some hosting environments restrict outbound HTTP requests or enforce strict SSL verification. If a remote license check fails for network reasons, WS Form will not deactivate your license immediately, but the log will show the failure so you can identify whether a network issue is contributing to the problem.
Enabling logging
Logging is controlled by the wsf_licensing_log filter hook. Add the following code to enable it:
add_filter( 'wsf_licensing_log', '__return_true' );
Where to add the filter
The filter can be added in any of the following locations depending on your setup.
- Active theme’s functions.php
The quickest option for temporary testing. Open your active theme’sfunctions.phpand add the filter there. Note that logging will stop if the theme is switched. - Code snippet plugin
If you use a plugin such as WPCode or Code Snippets, add the filter as a new PHP snippet. This is a good option if you want logging to persist regardless of theme changes.
Log file location
Entries are written to:
wp-content/uploads/ws-form/licensing/licensing.log
This path is inside the WordPress uploads directory structure used by WS Form. You can override it using the wsf_licensing_log_path filter:
add_filter( 'wsf_licensing_log_path', function( $path ) {
return 'licensing/custom-path';
} );
The path is relative to the WS Form uploads directory. The directory will be created automatically if it does not already exist, provided the web server has write permissions.
What gets logged
Each log entry includes a UTC timestamp, the site URL, the calling method, and a description of the event. Events that are always recorded:
- Activation attempts (manual and silent via constant)
- Activation success or failure, including the specific error code returned by the server
- Deactivation attempts and outcomes
- Remote license checks, including failures due to network errors
- Every time
license_activatedis set tofalse, with the reason - Every time the license expiry is cleared (
reset_license_expiry) - Detection and removal of the
WSF_LICENSE_KEYconstant - Transient expiry and refresh cycles
A typical log file looks like this:
[2025-06-01 09:14:02] [https://example.com] [caller:transient_check] Constant license key detected (WSF_LICENSE_KEY), attempting silent activation.
[2025-06-01 09:14:03] [https://example.com] [caller:activate] activate() called. silent=true
[2025-06-01 09:14:04] [https://example.com] [caller:activate] license_activated set to true: activation succeeded.
[2025-06-01 09:14:04] [https://example.com] [caller:set_license_expiry] License expiry set to: 2026-06-01 00:00:00
[2025-06-02 03:00:01] [https://example.com] [caller:transient_check] License transient expired or missing. Running remote license check.
[2025-06-02 03:00:02] [https://example.com] [caller:check] check() failed: network error or non-200 response.
[2025-06-02 03:00:02] [https://example.com] [caller:transient_check] Remote license check failed (network error or invalid response). Aborting transient check.
The last two lines in the example above indicate a network issue. The remote check failed but the license was not cleared. If you see license_activated set to false followed by a network failure, that points to a different code path and the caller field will identify it precisely.
File permission requirements
For logging to work, the web server process must have write access to the wp-content/ws-form/licensing/ directory. If this directory does not exist, WS Form will attempt to create it on first use.
If the directory cannot be created or written to, logging fails silently. No error is shown in the WordPress admin, no notice is logged to debug.log, and your site continues to function normally. This is intentional. The logging feature must never affect a live site.
Warning: If logging appears to be enabled but no log file is being created, check that the web server user has write permissions on the
wp-content/ws-form/directory.
Disabling logging
Remove or comment out the add_filter line you added earlier. The log file itself is not removed automatically. You can delete licensing.log manually once you have finished diagnosing the issue.
Warning: Do not leave logging enabled on a production site indefinitely. The log file grows with every license-related request and is not automatically rotated or pruned.