Make a Docker application write to stdout

An amazing recipe is given in the nginx Dockerfile: # forward request and error logs to docker log collector RUN ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stderr /var/log/nginx/error.log Simply, the app can continue writing to it as a file, but as a result the lines will go to stdout & stderr!

How can I send a message to the systemd journal from the command line?

systemd-cat is the equivalent to logger: echo ‘hello’ | systemd-cat In another terminal, running journalctl -f: Feb 07 13:38:33 localhost.localdomain cat[15162]: hello Priorities are specified just by part of the string: echo ‘hello’ | systemd-cat -p info echo ‘hello’ | systemd-cat -p warning echo ‘hello’ | systemd-cat -p emerg Warnings are bold, emergencies are bold … Read more

Debug log file with rolling datestamp in filename?

Well, yes – there is such way. And you even have the solution already in your code… Even more – you almost solved it yourself… This line decides, where the log will be located: @ini_set( ‘error_log’, dirname(__FILE__) . ‘/wp-content/debug.log’ ); So all you need is to add date in that file name. Like this: @ini_set( … Read more

Does WordPress provide different levels of logging?

Your understand is correct. WordPress doesn’t have levels beyond Warning and Error from PHP. Wonolog, a WordPress wrapper for Monolog, expands the default error logging into the levels you require. You can also expand the logging by adding your own custom debuging alerts and level.

Logging Count of Those Who Read Whole Post (ie reach the bottom)

Places to start: Detecting Bottom of the page Once you have detected you’re at the bottom, you’ll need to make an AJAX request using WP AJAX (tutorial) to save that data. You’ll probably want to store “read_whole_post” as a postmeta value. Something along the lines of this: add_action( ‘wp_ajax_read_whole_post’, ‘se200479_read_whole_post’ ); add_action( ‘wp_ajax_nopriv_read_whole_post’, ‘se200479_read_whole_post’ ); … Read more

Log of Heartbeat Calls

From quick look at the code, there is number of hooks firing in wp_ajax_heartbeat(). Out of which heartbeat_tick action seems quite appropriate to hook some logging logic too. For the sake of completeness, while you are interested in logged in activity, the hook would be heartbeat_nopriv_tick for logged out users.