백엔드/PHP
라라벨에서 sentry 사용해보기
프흐프좋아
2024. 5. 24. 16:26
에러로그를 잘 찍을 수 있는 도구인 sentry
나도 멋있게 에러로그를 확인해보고 싶었다!
1. sentry에 가입한다
2. project를 생성한다 (라라벨 선택)

3. https://docs.sentry.io/platforms/php/guides/laravel/other-versions/laravel8-10/#install
Laravel 8.x, 9.x and 10.x | Sentry for Laravel
Learn about using Sentry with Laravel 8.x, 9.x and 10.x.
docs.sentry.io
이제부터는 이 링크를 참조해서 작업하면 된다
본인의 맞는 라라벨 버전에 맞게 문서를 찾아서 하면 세팅 끝!
sentry는 문서가 엄청 잘 되어있는 것 같다
본인의 라라벨 버전 확인 방법 : php artisan --version
4. 작업이 완료된 후 에는 아래를 통해 테스트를 진행해보자
web.php에서 에러 throw해보기
Route::get('/debug-sentry', function () {
throw new Exception('My first Sentry error!');
});
or
php artisan 명령어 사용하기
php artisan sentry:test