2
How to make Microsoft Azure capture my errors?
I am currently dealing with errors with this function:
<?php
/**
  Plugin Name: TESTE
  Description: testando log novo
  Version: 1.0
  Author: Vteste
  Author URI: teste
  -------
  LICENSE: This file is subject to the terms and conditions defined in
  file 'license.txt', which is part of Advanced Access Manager source package.
 *
 */
// error handler function
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
    switch ($errno) {
    case E_USER_ERROR:
        $erro = "<b>My ERROR</b> [$errno] $errstr<br />\n";
        $erro += "  Fatal error on line $errline in file $errfile";
        $erro += ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
        $erro += "Aborting...<br />\n";
        echo $erro;
        exit(1);
        break;
    case E_USER_WARNING:
        $erro = "<b>My WARNING</b> [$errno] $errstr\n";
        break;
    case E_USER_NOTICE:
        $erro = "<b>My NOTICE</b> [$errno] $errstr\n";
        break;
    default:
        $erro = "Unknown error type: [$errno] $errstr, linha:$errline, no arquivo $errfile";
            error_log($erro);
        break;
    }
    /* Don't execute PHP internal error handler */
    return true;
}
// function to test the error handling
function scale_by_log($vect, $scale)
{
    if (!is_numeric($scale) || $scale <= 0) {
        trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale", E_USER_ERROR);
    }
    if (!is_array($vect)) {
        trigger_error("Incorrect input vector, array of values expected", E_USER_WARNING);
        return null;
    }
    $temp = array();
    foreach($vect as $pos => $value) {
        if (!is_numeric($value)) {
            trigger_error("Value at position $pos is not a number, using 0 (zero)", E_USER_NOTICE);
            $value = 0;
        }
        $temp[$pos] = log($scale) * $value;
    }
    return $temp;
}
// set to the user defined error handler
$old_error_handler = set_error_handler("myErrorHandler");
?>
And I use the plugin Application Insights | Microsoft Azure, however it is not collecting any kind of error, so would like to send manually as could do?

Works with Multisite ??
– Kaue Alves
@Kauealves multi-domains or multi-sites?
– Guilherme Nascimento
wordpress multisites
– Kaue Alves
@Kauealves can not say, if the multi-site are different wordpress applications I believe you will have to configure one by one, if it is the same application with multiple domains maybe it is not necessary.
– Guilherme Nascimento