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

Logging messages from console are not getting logged anywhere #17053

Closed
mstenz opened this issue Jan 6, 2021 · 8 comments · Fixed by #18358
Closed

Logging messages from console are not getting logged anywhere #17053

mstenz opened this issue Jan 6, 2021 · 8 comments · Fixed by #18358
Assignees
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Easier debugging For issues that make troubleshooting issues for developers easier. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone

Comments

@mstenz
Copy link

mstenz commented Jan 6, 2021

they are just shown on the console, there is no entry for hard error message in php_error.log (everything is silent) but also the logmessages manually shown are not recorded anywhere even debug logging is enabled in general.
Maybe it is worth to allow a seperate log file for the console. This includes especially the Tasks Scheduler Outputs and all other messages on the console.
The only messages i see in the debug log are when some archiving is done, but only the detailed sql queries, not the other messages what is now happening.

@tsteur
Copy link
Member

tsteur commented Jan 10, 2021

It seems to indeed not log to the matomo.log even when file logging is enabled. I can only assume this is on purpose currently. Haven't found yet where this is done though. Do you maybe know @diosmosis ?

Generally, we recommend people for cronjobs to pipe the output to a file like

./console ... > /path/to/cronjobs.log

Does this maybe help?

@tsteur tsteur added the Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. label Jan 10, 2021
@mstenz
Copy link
Author

mstenz commented Jan 10, 2021

Thx, i am using Windows. Logging like this in cron is not possible when using the Task Scheduler directly with arguments fields (as it is default).
The Problem with redirecting to file is that it does not use the different logging mechnics that Matomo have and also Debug Messages are not part of a normal console output.

@diosmosis
Copy link
Member

@tsteur it's in Monolog/config/cli.php, the log.handlers key is overridden to only output to console.

@tsteur
Copy link
Member

tsteur commented Jan 11, 2021

Thanks @diosmosis

@mattab @diosmosis @sgiehl does maybe anyone remember why that was done? I reckon if file logger is enabled, it be great to additionally also log to file. But maybe there's a reason for it... or it just was never implemented or forgotten.

@diosmosis
Copy link
Member

diosmosis commented Jan 11, 2021

Seems like it was on purpose, but I'm not sure why. Maybe there was the assumption CLI commands would be redirected if the output was to be saved. It would be easy to fix I think, just use a \DI\decorate.

@sgiehl
Copy link
Member

sgiehl commented Jan 11, 2021

Don't know a reason either. Guess would be fine to log them to file as well

@tsteur tsteur added c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. and removed Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. labels Jan 11, 2021
@tsteur tsteur added this to the 4.4.0 milestone Jan 11, 2021
@tsteur
Copy link
Member

tsteur commented Jan 11, 2021

👍 I'll put it into 4.4 as it would be useful potentially on cloud too. When a file logger is configured, it should also log to file.

@tsteur tsteur added the Easier debugging For issues that make troubleshooting issues for developers easier. label Jul 27, 2021
@tsteur
Copy link
Member

tsteur commented Oct 21, 2021

When a file logger is configured, and log level is set for example to warn, then it should log all warning messages also to the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Easier debugging For issues that make troubleshooting issues for developers easier. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants