snowplow / snowplow-php-tracker

Snowplow event tracker for PHP. Add analytics into your PHP apps and scripts
http://snowplowanalytics.com
34 stars 36 forks source link

No writing permission to /vendor/ folder for log file creation #142

Open kaurov opened 5 months ago

kaurov commented 5 months ago

Problem: To get response code from server, it is required to enable debugging. If to enable debugging then log file is located in ./vendor/snowplow/snowplow-tracker/debug/sync-events-log-6626efcd69d653.43454099.log it is hard-coded in \Snowplow\Tracker\Emitter::initDebugLogFiles()

Some web-script keeps this folder without writing permission. There is a need to be able to configure log file location in constructor

Attempt to work around -- failed To do it in 2 steps

$emitter = new SyncEmitter(static::COLLECTOR_HOST, "https", "POST", 1, false, 3);
$emitter ->setup('/../../../../../../../../../htdocs/uploads/prefix', true, 3);

This way I get no error on writing permission, but http requests are not sent to remote server.

Work around Declare debug mode in constructor and catch clear screen output

ob_start();
$emitter = new SyncEmitter("collector-endpoint.somedomain.com", "https", "POST", 1, false);
...
ob_end_clean();

Ideal solution

kaurov commented 4 months ago

https://stackoverflow.com/questions/55975535/how-do-you-associate-a-schema-with-a-payload