Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a log into a custom file instead of laravel.log file #1521

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public function runJob(
->where('id', '>', $max_statement_id)
->orderby('id', 'ASC')
->get();

try {
$service = new LearnerRecordStoreService();
foreach ($xapiStatements as $row) {
Expand Down Expand Up @@ -281,13 +280,19 @@ public function runJob(
}
}
} catch (Exception $e) {
Log::error('Summary page Cronjob crashed on row id ' . $row->id . ' - ' . $e->getMessage() . ' / Line = ' . $e->getLine());
Log::channel('cronjob')->error('Summary page Cronjob crashed on row id ' . $row->id . ' - ' . $e->getMessage() . ' / Line = ' . $e->getLine());
$errors = true;
}
}
\Log::info(date('Y-m-d h:i:s') . ' - Extract XAPI script ended');
if($errors && $errors == true){
return response()->json([
'message' => 'LRS cronjob has errors, please check LRS-Cronjob.log file.'
], 404);
}
Log::info(date('Y-m-d h:i:s') . ' - Extract XAPI script ended');
return 'Extract XAPI JSON Cron run successfully.';
} catch (Exception $e) {
\Log::error($e->getMessage());
Log::error($e->getMessage());
}
}
}
6 changes: 6 additions & 0 deletions config/logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
'level' => 'debug',
],

'cronjob' => [
'driver' => 'single',
'path' => storage_path('logs/LRS-Cronjob.log'),
'level' => 'debug',
],

'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
Expand Down