mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 18:44:28 -04: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
|
// 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";
|
$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;
|
return false;
|
||||||
} elseif ($e instanceof HttpResponseException) {
|
} elseif ($e instanceof HttpResponseException) {
|
||||||
return false;
|
return false;
|
||||||
@ -77,7 +81,11 @@ class Handler extends ExceptionHandler
|
|||||||
if (! Utils::isTravis()) {
|
if (! Utils::isTravis()) {
|
||||||
Utils::logError(Utils::getErrorString($e));
|
Utils::logError(Utils::getErrorString($e));
|
||||||
$stacktrace = date('Y-m-d h:i:s') . ' ' . $e->getMessage() . ': ' . $e->getTraceAsString() . "\n\n";
|
$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;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return parent::report($e);
|
return parent::report($e);
|
||||||
|
@ -105,8 +105,11 @@ class LoginController extends Controller
|
|||||||
*/
|
*/
|
||||||
} else {
|
} 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'));
|
$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);
|
if (config('app.log') == 'single') {
|
||||||
error_log('login failed');
|
file_put_contents(storage_path('logs/failed-logins.log'), $stacktrace, FILE_APPEND);
|
||||||
|
} else {
|
||||||
|
Utils::logError('[failed login] ' . $stacktrace);
|
||||||
|
}
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$user->failed_logins = $user->failed_logins + 1;
|
$user->failed_logins = $user->failed_logins + 1;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user