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

Incorrect filename is being logged #65

Open
bvanfleet opened this issue Oct 25, 2024 · 0 comments
Open

Incorrect filename is being logged #65

bvanfleet opened this issue Oct 25, 2024 · 0 comments

Comments

@bvanfleet
Copy link

Bug Report

Q A
Version 1.1.3

Summary

I've configured the deprecation logging against a PHP 8.1 project and am noticing that all my deprecation logs pointing to DBAL and deprecations packages, instead of the actual files where it's being triggered. This makes is very difficult for us to pinpoint the error in our project.

Current behavior

We've set up our logging in our app bootstrap as follows:

self::$deprecationLog = new Logger('DoctrineDeprecations');

if (Config::get('DEPRECATION_LOG_FILE')) {
    $output    = "[%datetime%] %level_name%: %message% %context% %extra%\n";
    $formatter = new QuantumLineFormatter($output);
    $stream    = new StreamHandler(Config::get('DEPRECATION_LOG_FILE'), Config::get('LOG_LEVEL'));
    $stream->setFormatter($formatter);

    self::$deprecationLog->pushHandler($stream);

    Deprecation::enableWithPsrLogger(self::$deprecationLog);
}

However, when we start our application and hit an area with known deprecations, the filename that is being logged is within the doctrine packages, instead of our code.

[2024-10-24T15:19:06.851853-04:00] NOTICE : Connection::fetchAssoc() is deprecated, use Connection::fetchAssociative() API instead. {"file":"/var/www/quantum/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":613,"package":"doctrine/dbal","link":"https://github.com/doctrine/dbal/pull/4019"} []
[2024-10-24T15:19:07.961852-04:00] NOTICE : Statement::execute() is deprecated, use Statement::executeQuery() or Statement::executeStatement() instead {"file":"/var/www/quantum/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php","line":166,"package":"doctrine/dbal","link":"https://github.com/doctrine/dbal/pull/4580"} []

I loaded up my debugger, and I did find the following within the Deprecation.php file:

image

Expected behavior

When a deprecation is logged, the filename should not be one related to doctrine projects. In this case, specifying $backtrace[1] appeared to be sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant