Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kaurov opened this issue Apr 23, 2024 · 1 comment
Open

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

kaurov opened this issue Apr 23, 2024 · 1 comment

Comments

@kaurov
Copy link
Contributor

kaurov commented Apr 23, 2024

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
@kaurov
Copy link
Contributor Author

kaurov commented May 23, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant