Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vpk's avatar
Level 1

Log info not working

I followed the instructions on Errors and Logging - Lumen.

Here is my UsersController.php file wherein I am trying to log information for debugging.:

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;

use Illuminate\Support\Facades\Hash;

use Illuminate\Http\Request;

use App\Users;

use Log;

class UsersController extends Controller

{

  public function __construct()

   {

   }

   /**
    * Display a listing of the resource.
    *
    * @return \Illuminate\Http\Response
    */

   public function authenticate(Request $request)

   {

        Log::info("hiiidsfoiasjdfisa");
        $this->validate($request, [

            'email' => 'required',
            'password' => 'required'

        ]);

        $user = Users::where('email', $request->input('email'))->first();

        Log::info($user->password);
        Log::info($user->email);    
        if(Hash::check($request->input('password'), $user->password)){

          $apikey = base64_encode(str_random(40));

          Users::where('email', $request->input('email'))->update(['api_key' => "$apikey"]);;
          return response()->json(['status' => 'success','api_key' => $apikey]);
        }
        else {
          return response()->json(['status' => 'fail'],401);
        }
    }
}    
?>

The statements for logging are placed in the authenticate method which is referenced via routes/web.php.

However I can't see any info logs in storage/logs/lumen.log. How can I view the info that I am trying to log?

Please help!

0 likes
2 replies
vpk's avatar
Level 1

I don't have APP_LOG and APP_LOG_LEVEL directives in my .env file for some reason. I can see all the errors I've encountered since creating the project but not the info level logs that I've tried to make.

Please or to participate in this conversation.