最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

laravel - My queue:work and queue:listen are not showing anything? - Stack Overflow

programmeradmin3浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 3

Laravel 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.

发布评论

评论列表(0)

  1. 暂无评论