Projet

Général

Profil

Actions

Anomalie #32377

fermé

Impossible d'initialiser les logs de SLIM au chargement

Ajouté par Jean-Laurent DUZANT il y a 17 jours. Mis à jour il y a 6 jours.

Statut:
R&D - Terminé
Priorité:
2-Sérieux
Assigné à:
Version cible:
Début:
05/02/2025
Echéance:

Description

Lors du chargement de Maarch Courrier sans inclure la référence du custom dans l’URL, il se peut que MC n’applique pas la configuration adéquate.

En l'absence d'une configuration spécifique pour le custom ou d'un socle standard, il convient de charger la configuration par défaut.

( ! ) Fatal error: Uncaught TypeError: SrcCore\controllers\LogsController::initMonologLogger(): Argument #1 ($logConfig) must be of type array, null given, called in /var/www/html/courrier-24/rest/index.php on line 810 and defined in /var/www/html/courrier-24/src/core/controllers/LogsController.php on line 46
( ! ) TypeError: SrcCore\controllers\LogsController::initMonologLogger(): Argument #1 ($logConfig) must be of type array, null given, called in /var/www/html/courrier-24/rest/index.php on line 810 in /var/www/html/courrier-24/src/core/controllers/LogsController.php on line 46
Call Stack

Time Memory Function Location

1 0.0003 376808 {main}( ) .../index.php:0
2 0.0068 713112 SrcCore\controllers\LogsController::initMonologLogger( $logConfig = NULL, $loggerConfig = ['code' => 400, 'errors' => 'Log config of type 'logTechnique' does not exist'], $isCustomFormatLineUse = FALSE, $name = 'Slim' ) .../index.php:810

Proposition de code de la fonction getLogConfig dans LogsController

public static function getLogConfig(): ?array
{
    $configPaths = [
        'config/config.json',
        'config/config.json.default'
    ];

    foreach ($configPaths as $path) {
        $config = CoreConfigModel::getJsonLoaded(['path' => $path]);
        if (!empty($config['log'])) {
            return $config['log'];
        }
    }

    return null;
}

Fichiers

clipboard-202502051707-xe46u.png (16,1 ko) clipboard-202502051707-xe46u.png Jean-Laurent DUZANT, 05/02/2025 17:07
Actions

Formats disponibles : Atom PDF