This is my package laravel-bugsnag-download-logs
sodalitedana/laravel-bugsnag-download-logs is a Laravel package for this is my package laravel-bugsnag-download-logs.
It currently has 0 GitHub stars and 28 downloads on Packagist (latest version v1.0.7).
Install it with composer require sodalitedana/laravel-bugsnag-download-logs.
Discover more Laravel packages by sodalitedana
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel package that provides an Artisan command to download error logs from Bugsnag and save them to your application's laravel.log file.
--status option (open, resolved, etc.)--days option (default: last 7 days)Install the package via Composer:
composer require sodalitedana/laravel-bugsnag-download-logs
Publish the configuration file:
php artisan vendor:publish --tag=laravel-bugsnag-download-logs-config
Add your Bugsnag Personal Auth Token to your .env file:
BUGSNAG_API_TOKEN=your_personal_auth_token_here
How to get the token:
The configuration file is published to config/laravel-bugsnag-download-logs.php:
<?php
return [
'token' => env('BUGSNAG_API_TOKEN'),
];
Run the command to download errors:
php artisan bugsnag:download-logs
The command will guide you through:
laravel.log# Download errors from the last 30 days
php artisan bugsnag:download-logs --days=30
# Download only resolved errors
php artisan bugsnag:download-logs --status=resolved
# Combine options
php artisan bugsnag:download-logs --days=7 --status=open
Available options:
--days=N : Number of days to retrieve errors from (default: 7)--status=X : Error status to filter by (default: open)
open, resolved, ignored, snoozed$ php artisan bugsnag:download-logs
π Bugsnag Organization & Projects Finder + Logs Downloader
π Fetching organizations...
π’ Available organizations:
βββββββββββββββ¬ββββββββββββββ¬βββββββββββββββββββββββββββ
β Name β Slug β ID β
βββββββββββββββΌββββββββββββββΌβββββββββββββββββββββββββββ€
β My Company β my-company β 507f1f77bcf86cd799439011 β
βββββββββββββββ΄ββββββββββββββ΄βββββββββββββββββββββββββββ
Select an organization: My Company (my-company)
β
Selected organization: My Company
π Fetching projects...
π¦ Available projects:
βββββββββββββββ¬ββββββββββββββ¬βββββββββββββββββββββββββββ¬ββββββββββββββ
β Name β Slug β ID β Open Errors β
βββββββββββββββΌββββββββββββββΌβββββββββββββββββββββββββββΌββββββββββββββ€
β My App β my-app β 507f1f77bcf86cd799439012 β 15 β
βββββββββββββββ΄ββββββββββββββ΄βββββββββββββββββββββββββββ΄ββββββββββββββ
Enter project name (name or slug): my-app
β
Project found:
Name: My App
Slug: my-app
ID: 507f1f77bcf86cd799439012
Open errors: 15
π₯ Downloading open errors from the last 7 days...
β‘ Processing 15 errors...
β
Successfully saved 15 errors to laravel.log
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββββββ
β Error Class β Message β First Seen β File β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββΌββββββββββββββββββΌββββββββββββββββββββββ€
β RuntimeException β Database connection failed β 2 hours ago β app/Models/User.php β
β InvalidArgumentEx.. β Invalid email format β 5 hours ago β app/Http/Contro... β
βββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββ΄ββββββββββββββββββ΄ββββββββββββββββββββββ
... and 5 more errors. Check laravel.log for complete details.
Errors are saved to laravel.log in this format:
[2024-09-24 14:30:22] local.ERROR: Bugsnag Error: RuntimeException {
"error_class": "RuntimeException",
"message": "Database connection failed",
"context": "production",
"first_seen": "2024-09-24T12:30:22.000Z",
"grouping_fields": {
"errorClass": "RuntimeException",
"file": "app/Models/User.php",
"code": "42"
}
}
β BUGSNAG_API_TOKEN not configured in .env
π‘ Add to .env file: BUGSNAG_API_TOKEN = your_personal_auth_token
Solution: Verify the token is present in your .env file and the configuration file has been published.
β Project 'project-name' not found.
π‘ Use one of the names or slugs shown in the table above.
Solution: Use exactly the name or slug shown in the available projects table.
β Error retrieving logs from Bugsnag: 401
Solutions:
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
If you discover a security vulnerability, please send an email to [email protected].
The MIT License (MIT). Please see License File for more information.