-
Notifications
You must be signed in to change notification settings - Fork 94
Logging Methods
CampTix supports many different methods of logging details about ticket creation, attendee registration, and other events that occur within the system. We ship with three different methods, and others are available via extra plugins or by writing your own.
The default method used is 'Meta' logging, where details related to a specific attendee are displayed in a meta box on each attendee's record in the Attendees page.
The downside to the Meta method is that not all information related to an attendee is recorded. Specifically, many transaction details are not recorded, so troubleshooting problems with payment gateways can be difficult. You should try the Database method instead.
If you're running a WordPress MultiSite network, you can install the CampTix Network Tools plugin and then logs for all sites on the network will be stored in the database and displayed in the Network Admin area.
This method logs all entries to a file on the server's file system. By default, entries are stored in /tmp/camptix.log
, but that location can be configured with a filter.
To enable the File method, place this PHP code in a functionality plugin:
/**
* Enable the file logging addon in CampTix
* @param array $addons
* @return array
*/
function enable_camptix_file_logging( $addons ) {
$addons[] = $GLOBALS['camptix']->get_default_addon_path( 'logging-file.php' );
return $addons;
}
add_filter( 'camptix_default_addons', 'enable_camptix_file_logging' );
To change the location of the log file, use this code and change the path to match where you want the file to be stored. Make sure the web server has permission to write to the location you choose.
/**
* Set the location of the CampTix file log
* @param string $location
* @return string
*/
function set_camptix_log_location( $location ) {
return '/home/username/logs/camptix.log';
}
add_filter( 'camptix_logfile_path', 'set_camptix_log_location' );
Warning: The logs will contain sensitive data, so we strongly recommend that you place the log file outside your web root, so that it is not accessible over HTTP. If you have to place it inside, then make sure you use .htaccess
rules to block access to it, and verify that it is being blocked.
This method also logs to the file system, but stores the data in the JSON format. You can configured it the same was as normal file logging, but with logging-file-json.php
as the method filename and camptix_logfile_json_path
as the location filter name.
You can also write a custom logging method if you'd like. Check out the source code for the methods above to see examples of how it's done.