+ cat /etc/docker/daemon.json
{
"log-driver": "syslog"
}
+ cat docker-compose.yml
services:
my:
image: php:apache
volumes:
- ./index.php:/var/www/html/index.php
+ cat index.php
<?php
function dump($intro, $deepening) {
echo "$intro: $deepening\n";
}
function abc_number() {
global $argv;
static $number = 0;
return "{$argv[1]}" . ++$number;
}
ini_set('error_log', 'syslog');
dump("error_log", ini_get('error_log'));
syslog(LOG_NOTICE, abc_number());
error_log(abc_number());
trigger_error(abc_number());
throw new Exception(abc_number());
+ sudo systemctl restart docker
+ docker-compose run my php index.php DOCKER-ABC
[cut]
error_log: syslog
[cut]
+ journalctl -b | grep DOCKER-ABC
[cut]: Notice: DOCKER-ABC3 in /var/www/html/index.php on line 19
[cut]: Fatal error: Uncaught Exception: DOCKER-ABC4 in /var/www/html/index.php:20
It seems that syslog() and error_log() not work.
Ineed DOCKER-ABC1 and DOCKER-ABC2 do not appear.
Why?