Code snippets
Code snippets
Copy-ready answers to everyday coding questions, each with a short explanation. Laravel, PHP, JavaScript, SQL, Bash and more.
2 snippets tagged #debugging · Show all
Bash
October 17, 2026
Linux tail and follow log files in real time
Watches a log as new lines arrive. Use it to debug a running app or service.
tail -f storage/logs/laravel.log # follow a file
tail -n 100 -f /var/log/nginx/error.log # last 100 lines, then follow
journalctl -u nginx -f # follow a systemd service
journalctl -u nginx --since "1 hour ago"
PHP
October 10, 2026
Laravel Context facade add data to every log entry
Stores values once and attaches them to all later log entries in the request, and to queued jobs dispatched from it. Use it for a request or trace ID so you can...
<?php
use Illuminate\Support\Facades\Context;
use Illuminate\Support\Facades\Log;