NotionCommotion Posted December 31, 2020 Share Posted December 31, 2020 My typical approach to logging is as follows: openlog('PublicAPI', LOG_CONS | LOG_NDELAY | LOG_PID, LOG_USER | LOG_PERROR); syslog(LOG_INFO, 'some info'); syslog(LOG_ERR, 'some error'); And then when debugging script, I just use the following: journalctl -f -uphp73-php-fpm -uphp-fpm -ureact_php_systemctl_service While it works okay, often I get more content shown by journalctl that I would like. Another downfall is segfaults are not displayed, and the only way I have been able to view them is by not including a systemd unit (i.e. -u) and just using journalctl -f, but then I get way more content that I desire. Recently, I was running some script and none of my units (i.e. -uphp73-php-fpm -uphp-fpm -ureact_php_systemctl_service) filtered it. I then tried journalctl -f | grep PublicAPI, and while it worked, errors didn't show as red and I expect it just isn't the right way to do it. Next I tried journalctl -ft PublicAPI, and it seemed like a better approach. How should I be doing this? How can I filter just segfaults when something is not going right? Should I be filtering by unit and how can I identify what unit to use? Is a better approach to filter by user (not sure if possible)? Thanks Quote Link to comment Share on other sites More sharing options...
gw1500se Posted December 31, 2020 Share Posted December 31, 2020 This is not really a PHP issue. I suggest you ask this on the appropriate *NIX forum. Quote Link to comment Share on other sites More sharing options...
requinix Posted December 31, 2020 Share Posted December 31, 2020 My first reaction would be "don't use syslog for regular logging". It's fine for important things, but miscellaneous info and error messages can get lost in the sea of other activity. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.