Skip to content

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

Open
@kaurov

Description

@kaurov

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

  • To be able to configure log file location in constructor.
  • To be able to configure log file location in $emitter ->setup()method without causing all request mocked -- not sent to remote server
  • To be able to disable logging in file as well -- e.g. I am using only returned array.
  • To be able to disable var_dumps to screen -- e.g. to use $output object or to have 2 modes -- 1) return server responses only 2) real debugging with output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions