Comments (4)
Create the following file:
app/config/packages/sentry/sentry-laravel/local/config.php
With these contents:
<?php
return array(
'dsn' => '',
);
Event in the package folders you can use environment folders to overwrite configuration.
No need for custom filtering :) Although the App::error()
filter for ModelNotFoundException
is a smart one, since that is missing from <5
by default.
from sentry-laravel.
This is really only applicable for 4.2 installs cos it's easy enough to do in your report method in Laravel 5.
What I've done to get around this is:
$this->app->resolving('sentry', function($client) {
if ($this->app->environment('local')) {
$client->server = null;
}
return $client;
});
Sentry won't report anything where there isn't a server set. Not pretty, but works.
from sentry-laravel.
Further to this I've found this is a better way of doing it on 4.2 if you want to add exceptions to what get's reported:
put inside app\start\global.php
App::error(function(Exception $exception, $code)
{
$doNotLog = [
'Symfony\Component\HttpKernel\Exception\NotFoundHttpException',
'Illuminate\Database\Eloquent\ModelNotFoundException'
];
$shouldLog = ! in_array(get_class($exception), $doNotLog);
if ($shouldLog) {
Log::error($exception);
}
if (! $shouldLog || app()->environment('local')) {
app('sentry')->server = null;
}
});
from sentry-laravel.
In this method: \App\Exceptions\Handler::report
Change this code:
/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
if (app()->bound('sentry') && $this->shouldReport($exception)){
app('sentry')->captureException($exception);
}
parent::report($exception);
}
With this one:
/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
if (app()->bound('sentry') && $this->shouldReport($exception) && config('app.env') !== 'local'){
app('sentry')->captureException($exception);
}
parent::report($exception);
}
from sentry-laravel.
Related Issues (20)
- Lumen does not have the `Illuminate\Routing\Events\RouteMatched event`. HOT 1
- Report missing translations
- Unable to set up sentry sdk debug logger option in Laravel 7 HOT 11
- Data not being send to Sentry HOT 2
- [Cron Monitoring] Whether to consider adding a switch configuration option for Cron monitoring? HOT 2
- Configure Cron Monitoring based on environment HOT 1
- Idle timeout reached HOT 4
- Scheduled task tracing
- Disabling SSL Verify Peer HOT 2
- Add support for Laravel 11.0's Context
- Link to Laravel v10 docs broken HOT 2
- Dependency nyholm/psr7 can be defined like require-dev HOT 1
- Does captureUnhandleException still work for Laravel 11 HOT 1
- SQLSTATE[HY000]: General error: 2006 MySQL server has gone away HOT 6
- Metrics Rate Limits HOT 1
- Wrong stack trace when using in-app middleware HOT 6
- FilesystemAdapterDecorator incompatibility in tests. HOT 2
- Performance monitoring doesn't work in artisan commands
- LighthouseIntegration does not report all the traces to Sentry HOT 4
- Call to undefined function Sentry\metrics() HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-laravel.