I created a job in laravel , and when i try to dispatch it , i just want to check some logs , it is not showing anything? can someone help me ?
public function handle(): void
{
Log::info('HandleBattleProgress job started for houseId: ' . $this->houseId);
try{
$battleMode = BattleMode::where('house_id', $this->houseId)->first();
Log::info('Getting the BattleMode', ['BattleMode' => $battleMode]);
if (!$battleMode) {
BattleMode::create([
'house_id' => $this->houseId,
'start_xp' => 0,
'target_xp' => 1000,
'phase' => 'phase_1',
'battle_xp' => 0,
'is_in_battle' => false,
]);
Log::info('Creating BattleMode');
}
$house = House::find($this->houseId);
Log::info('Getting The House Id', ['houseId' => $house]);
if (!$house) {
Log::info('Returned, didn\'t get the house id');
return;
}
$this->applyBattleProgress($battleMode, $house);
if ($battleMode->battle_xp >= $battleMode->target_xp) {
$this->transitionBattlePhase($house, $battleMode);
}
if ($this->isBattleTime($battleMode)) {
$this->triggerBattle($battleMode);
}
$battleMode->save();
} catch( \Exception $e) {
Log::error('Error processing ' . $e->getMessage());
}
}
Where im dispatching in my controller
public function handleBattleProgress($houseId)
{
Log::info('Dispatching job for houseId: ' . $houseId);
HandleBattleProgress::dispatch($houseId);
return response()->json(['message' => 'Battle progress is being handled']);
}
-- and the env is set to database instead of sync
QUEUE_CONNECTION=database
**And all i see is EnisA@NB-1052 MINGW64 /c/laragon/www/houses-backend-main-1/houses-backend (Enis/implementing-Bug-Plante) $ php artisan queue:listen INFO Processing jobs from the [default] queue. EnisA@NB-1052 MINGW64 /c/laragon/www/houses-backend-main-1/houses-backend (Enis/implementing-Bug-Plante) $ php artisan queue:work INFO Processing jobs from the [default] queue.
**
I created a job in laravel , and when i try to dispatch it , i just want to check some logs , it is not showing anything? can someone help me ?
public function handle(): void
{
Log::info('HandleBattleProgress job started for houseId: ' . $this->houseId);
try{
$battleMode = BattleMode::where('house_id', $this->houseId)->first();
Log::info('Getting the BattleMode', ['BattleMode' => $battleMode]);
if (!$battleMode) {
BattleMode::create([
'house_id' => $this->houseId,
'start_xp' => 0,
'target_xp' => 1000,
'phase' => 'phase_1',
'battle_xp' => 0,
'is_in_battle' => false,
]);
Log::info('Creating BattleMode');
}
$house = House::find($this->houseId);
Log::info('Getting The House Id', ['houseId' => $house]);
if (!$house) {
Log::info('Returned, didn\'t get the house id');
return;
}
$this->applyBattleProgress($battleMode, $house);
if ($battleMode->battle_xp >= $battleMode->target_xp) {
$this->transitionBattlePhase($house, $battleMode);
}
if ($this->isBattleTime($battleMode)) {
$this->triggerBattle($battleMode);
}
$battleMode->save();
} catch( \Exception $e) {
Log::error('Error processing ' . $e->getMessage());
}
}
Where im dispatching in my controller
public function handleBattleProgress($houseId)
{
Log::info('Dispatching job for houseId: ' . $houseId);
HandleBattleProgress::dispatch($houseId);
return response()->json(['message' => 'Battle progress is being handled']);
}
-- and the env is set to database instead of sync
QUEUE_CONNECTION=database
**And all i see is EnisA@NB-1052 MINGW64 /c/laragon/www/houses-backend-main-1/houses-backend (Enis/implementing-Bug-Plante) $ php artisan queue:listen INFO Processing jobs from the [default] queue. EnisA@NB-1052 MINGW64 /c/laragon/www/houses-backend-main-1/houses-backend (Enis/implementing-Bug-Plante) $ php artisan queue:work INFO Processing jobs from the [default] queue.
**
Share Improve this question asked Jan 20 at 10:48 Enis AbaziEnis Abazi 73 bronze badges1 Answer
Reset to default 3Laravel logs are usually stored in storage/logs/laravel.log. Check if the logs are being written there:
tail -f storage/logs/laravel.log
If logs are missing, ensure the logging configuration in your .env file is correctly set:
LOG_CHANNEL=stack
LOG_LEVEL=debug
If it's set to error
, change it to debug
to capture all log levels.