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

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

Closed
dafriend opened this issue Mar 22, 2020 · 0 comments
Closed

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

dafriend opened this issue Mar 22, 2020 · 0 comments
Assignees
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@dafriend
Copy link
Contributor

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

@dafriend dafriend added the bug Verified issues on the current code behavior or pull requests that will fix them label Mar 22, 2020
@MGatner MGatner closed this as completed Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

2 participants