mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-19 16:01:34 +02:00
Improve logging config
This commit is contained in:
parent
f14fc6291c
commit
3752d6eb66
@ -68,7 +68,11 @@ class Handler extends ExceptionHandler
|
||||
}
|
||||
// Log 404s to a separate file
|
||||
$errorStr = date('Y-m-d h:i:s') . ' ' . $e->getMessage() . ' URL:' . request()->url() . "\n" . json_encode(Utils::prepareErrorData('PHP')) . "\n\n";
|
||||
@file_put_contents(storage_path('logs/not-found.log'), $errorStr, FILE_APPEND);
|
||||
if (config('app.log') == 'single') {
|
||||
@file_put_contents(storage_path('logs/not-found.log'), $errorStr, FILE_APPEND);
|
||||
} else {
|
||||
Utils::logError('[not found] ' . $errorStr);
|
||||
}
|
||||
return false;
|
||||
} elseif ($e instanceof HttpResponseException) {
|
||||
return false;
|
||||
@ -77,7 +81,11 @@ class Handler extends ExceptionHandler
|
||||
if (! Utils::isTravis()) {
|
||||
Utils::logError(Utils::getErrorString($e));
|
||||
$stacktrace = date('Y-m-d h:i:s') . ' ' . $e->getMessage() . ': ' . $e->getTraceAsString() . "\n\n";
|
||||
@file_put_contents(storage_path('logs/stacktrace.log'), $stacktrace, FILE_APPEND);
|
||||
if (config('app.log') == 'single') {
|
||||
@file_put_contents(storage_path('logs/stacktrace.log'), $stacktrace, FILE_APPEND);
|
||||
} else {
|
||||
Utils::logError('[stacktrace] ' . $errorStr);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return parent::report($e);
|
||||
|
@ -105,8 +105,11 @@ class LoginController extends Controller
|
||||
*/
|
||||
} else {
|
||||
$stacktrace = sprintf("%s %s %s %s\n", date('Y-m-d h:i:s'), $request->input('email'), \Request::getClientIp(), array_get($_SERVER, 'HTTP_USER_AGENT'));
|
||||
file_put_contents(storage_path('logs/failed-logins.log'), $stacktrace, FILE_APPEND);
|
||||
error_log('login failed');
|
||||
if (config('app.log') == 'single') {
|
||||
file_put_contents(storage_path('logs/failed-logins.log'), $stacktrace, FILE_APPEND);
|
||||
} else {
|
||||
Utils::logError('[failed login] ' . $stacktrace);
|
||||
}
|
||||
if ($user) {
|
||||
$user->failed_logins = $user->failed_logins + 1;
|
||||
$user->save();
|
||||
|
Loading…
Reference in New Issue
Block a user