Monolog on the server incorrectly displays Cyrillic.

 <?php require 'vendor/autoload.php'; use Monolog\Logger; use Monolog\Handler\StreamHandler; $log->pushHandler(new StreamHandler('logs/app.log', Logger::DEBUG)); $log->addInfo('Результат', array('тест' => 'тест')); 

On the local computer:

app.log :

 [2016-07-14 17:00:28] test.INFO: Результат {"тест":"тест"} [] 

On server

app.log :

 [2016-07-14 17:01:24] test.INFO: Результат {"\u0442\u0435\u0441\u0442":"\u0442\u0435\u0441\u0442"} [] 
  • one
    on the server, probably, the PHP version <5.4 - Sergiks
  • Yes, on server 5.3.3 - Umanshield

1 answer 1

The JSON_UNESCAPED_UNICODE option, which allows json_encode() write unicode characters as they were without transformation into \u0442 , has been introduced in PHP since version 5.4.0, so it isn’t on the server, and unicode characters are written in the escaped form.