Skip to content

Bug: Logger context placeholders {file} and {line} are wrong #2743

Description

@dafriend

Describe the bug
The values for {file} and {line} should be for the location where the call to log something occurred.
Instead, the file sometimes evaluates to the Logger class name or the class file.
The line number is usually, but not always, correct.

CodeIgniter 4 version
v 4.0.2

Given this controller

<?php namespace App\Controllers;

class Home extends BaseController
{
	public function index()
	{
		$this->logger->critical("FILE: {file} LINE:{line}");  // line 7
	}

}

The log entry produced is

CRITICAL - 2020-03-22 01:03:47 --> FILE: CodeIgniter\Log\Logger LINE:7

But it should be

CRITICAL - 2020-03-22 00:19:03 --> FILE: APPPATH/Controllers/Home.php LINE:7

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugVerified issues on the current code behavior or pull requests that will fix them

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions