A
A
ArrayPop2021-01-10 14:38:00
1C-Bitrix
ArrayPop, 2021-01-10 14:38:00

What does the php extension mean in the context of bitrix logs?

5ffae4dde8a35493508761.png
Here's a screenshot of it in the documentation for the .settings.php file.
This is about customizing the output of errors to the logs. Everything is clear there except for the extension point. What extensions can there be, is there an example of any MyLogExt?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2021-01-10
@ArrayPop

Judging by the sources, this field is used only in the extension_loaded() check and nowhere else - if you specify an unloaded extension, logging will be disabled.
The next step is the class_exists() check, which makes the previous check redundant.
That is, we are talking about the PHP extension, but it is essentially not used in any way. Apparently, it was assumed that they would write their own native extensions for more efficient logging, and it is possible that such an extension would even be supplied with Bitrix. But I'm not at all sure that it is possible to inherit the required ExceptionHandlerLog class from the Bitrix core in a custom extension.

The code
public function createExceptionHandlerLog()
{
    $exceptionHandling = Config\Configuration::getValue("exception_handling");
    if ($exceptionHandling === null || !is_array($exceptionHandling) || !isset($exceptionHandling["log"]) || !is_array($exceptionHandling["log"]))
        return null;

    $options = $exceptionHandling["log"];

    $log = null;

    if (isset($options["class_name"]) && !empty($options["class_name"]))
    {
        if (isset($options["extension"]) && !empty($options["extension"]) && !extension_loaded($options["extension"]))
            return null;

        if (isset($options["required_file"]) && !empty($options["required_file"]) && ($requiredFile = Loader::getLocal($options["required_file"])) !== false)
            require_once($requiredFile);

        $className = $options["class_name"];
        if (!class_exists($className))
            return null;

        $log = new $className();
    }
    elseif (isset($options["settings"]) && is_array($options["settings"]))
    {
        $log = new Diag\FileExceptionHandlerLog();
    }
    else
    {
        return null;
    }

    $log->initialize(
        isset($options["settings"]) && is_array($options["settings"]) ? $options["settings"] : array()
    );

    return $log;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question