- 404 Error Logging - Automatically logs all 404 errors with detailed information
- Smart Filtering - Configurable patterns to skip logging for admin, API, and static files
- Aggregated View - Groups identical URLs with occurrence count and timestamps
- Detailed Analytics - View statistics, trends, and individual log entries
- Multi-language Support - Available in 8 languages (EN, CS, SK, PL, DE, FR, IT, ES)
- Admin Integration - Seamless integration into Sylius admin panel
- Redirect Plugin Integration - Works perfectly with setono/sylius-redirect-plugin for complete 404 error management
The plugin adds a new "404 Logs" section to your Sylius admin panel where you can:
- See detailed information for each URL
- View aggregated 404 errors with occurrence counts
- Delete logs for specific URLs
- Filter by domain, URL path, and occurrence count
- View error statistics and trends
- Run
composer require 3brs/sylius-404-log-plugin
. - Register
\ThreeBRS\Sylius404LogPlugin\ThreeBRSSylius404LogPlugin
in your Kernel. - Import the plugin configuration in your
config/packages/_sylius.yaml
:- { resource: "@ThreeBRSSylius404LogPlugin/Resources/config/config.yaml" }
- Import the plugin routes in your
config/routes.yaml
:three_brs_sylius_404_log_plugin: resource: "@ThreeBRSSylius404LogPlugin/Resources/config/routes.yaml"
- Create and run doctrine database migrations:
bin/console doctrine:migrations:diff bin/console doctrine:migrations:migrate
By default, the plugin skips logging for certain URL patterns to avoid noise. You can customize this behavior in your config/services.yaml
:
parameters:
# Override default skip patterns
three_brs_sylius_404_log_plugin.skip_patterns:
- '/admin' # Admin section
- '/api' # API endpoints
- '/_' # Symfony profiler
Disable filtering (log everything):
parameters:
three_brs_sylius_404_log_plugin.skip_patterns: []
The plugin includes translations for:
- 🇬🇧 English (en)
- 🇨🇿 Czech (cs)
- 🇸🇰 Slovak (sk)
- 🇵🇱 Polish (pl)
- 🇩🇪 German (de)
- 🇫🇷 French (fr)
- 🇮🇹 Italian (it)
- 🇪🇸 Spanish (es)
After installation, navigate to your Sylius admin panel. You'll find a new "404 Logs" menu item that provides:
- Aggregated Log View - Overview of all unique 404 URLs with occurrence counts
- Detailed Log View - Individual log entries with timestamps and user agent information, view trends and statistics over time
- Filtering & Search - Filter logs by domain, URL path, and occurrence count
The plugin provides a console command to clean up old 404 logs automatically. This is useful for maintaining database performance and preventing excessive storage usage.
php bin/console three-brs:404-logs:cleanup [days] [options]
Arguments:
days
- Number of days to keep logs (older logs will be deleted)
Options:
--dry-run
- Show what would be deleted without actually deleting--batch-size=N
- Number of records to delete in each batch (default: 1000)
Examples:
# Delete logs older than 30 days
php bin/console three-brs:404-logs:cleanup 30
This plugin works excellently together with setono/sylius-redirect-plugin to provide a complete 404 error management solution.
Why combine both plugins?
- 404 Log Plugin: Identifies which URLs are generating 404 errors
- Setono Redirect Plugin: Allows you to create redirects for those problematic URLs
Recommended workflow:
- Monitor 404 errors using this plugin to identify frequently accessed broken URLs
- Create redirects in the Setono Redirect Plugin admin panel for important URLs
- Track effectiveness by monitoring if 404 occurrences decrease after implementing redirects
Installation of Setono Redirect Plugin:
composer require setono/sylius-redirect-plugin
Integration benefits:
- Data-driven redirects: Use 404 logs to prioritize which redirects to create
- SEO improvement: Fix broken links that hurt search engine rankings
- Better UX: Automatically redirect users to relevant content instead of showing 404 errors
- Analytics: Monitor redirect effectiveness by tracking 404 reduction
Best practices when using both plugins:
- Review 404 logs weekly to identify new broken URLs
- Create redirects for high-traffic 404 URLs (URLs with many occurrences)
- Use meaningful redirect targets based on URL similarity or content relevance
- Monitor redirect performance by checking if specific URLs stop appearing in 404 logs
- Create symlink from .env.dist to .env or create your own .env file
- Develop your plugin in
/src
- See
bin/
for useful commands
After your changes you must ensure that the tests are still passing.
$ composer install
$ bin/console doctrine:schema:create -e test
$ bin/phpstan.sh
$ bin/ecs.sh
We welcome contributions! Please feel free to submit pull requests or open issues for bugs and feature requests.
This library is under the MIT license.
Developed by 3BRS