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]: \Phalcon\Logger\LoggerFactory->load loses the adapter key name #15831

Closed
hayeslam opened this issue Dec 16, 2021 · 1 comment
Closed
Assignees
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: high High

Comments

@hayeslam
Copy link

When using \Phalcon\Logger\LoggerFactory to load the Logger, the key name of the adapter is lost.

Document example:

<?php

use Phalcon\Logger\AdapterFactory;
use Phalcon\Logger\LoggerFactory;

$config = [
    "name"     => "prod-logger",
    "adapters" => [
        "main"  => [
            "adapter" => "stream",
            "name"    => "/storage/logs/main.log",
            "options" => []
        ],
        "admin" => [
            "adapter" => "stream",
            "name"    => "/storage/logs/admin.log",
            "options" => []
        ],
    ],
];

$adapterFactory = new AdapterFactory();
$loggerFactory  = new LoggerFactory($adapterFactory);

$logger = $loggerFactory->load($config);

$logger->getAdapter('main'); // Throw exception: Fatal error: Uncaught Phalcon\Logger\Exception: Adapter does not exist for this logger in phalcon/Logger.zep:208
$logger->getAdapter(0);  // Return the main adapter object.

Phalcon 4.1.0

@hayeslam hayeslam added bug A bug report status: unverified Unverified labels Dec 16, 2021
@niden niden added 5.0 The issues we want to solve in the 5.0 release status: high High and removed status: unverified Unverified labels Dec 20, 2021
@niden niden self-assigned this Dec 20, 2021
@niden niden mentioned this issue Dec 20, 2021
5 tasks
@niden
Copy link
Member

niden commented Dec 20, 2021

@hayeslam Thank you for reporting this.

Resolved in #15835

@niden niden closed this as completed Dec 20, 2021
@niden niden moved this to Released in Phalcon v5 Aug 25, 2022
@niden niden added this to Phalcon v5 Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: high High
Projects
Archived in project
Development

No branches or pull requests

2 participants