Heya!
Using the following setup for PHP Apache:
FROM php:7.1-apache
# install the PHP extensions we need
RUN set -ex; \
\
apt-get update; \
apt-get install -y \
libjpeg-dev \
libpng-dev \
; \
rm -rf /var/lib/apt/lists/*; \
\
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-install gd mysqli opcache
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# Sets custom PHP.ini for error logging
RUN { \
touch /usr/local/etc/php/php.ini; \
echo "log_errors = On"; \
echo "error_log = /dev/stderr" \
echo "error_reporting = E_ALL"; \
} > /usr/local/etc/php/php.ini
RUN a2enmod rewrite expires
CMD ["apache2-foreground"]
I get a lot of HTTP logging (from apache I suppose) by default in the docker window.
Is there a way to disable this?
As you can tell I have also enabled error logging by writing to php.ini, which is working just fine.
But the php logging is hard to spot between the apache logging, so I want to disable it.
I would've added a question label but it seems I am unable to do so.
Best
The reason for the chatter is that in /var/log/apache2, you have the following symlink:
lrwxrwxrwx 1 root root 11 Dec 1 01:48 access.log -> /dev/stdout
and stdout is piped to the Docker logs by default. Since that's behavior you want, you should change the apache logs destination in your Dockerfile by either:
A) Delete the access.log symlink and recreate it as a normal file.
-or-
B) Edit the various confs, similar to the solution here (https://github.com/docker-library/php/issues/246#issuecomment-328215790) and point the logs somewhere else.
for reference on tactic B:
/etc/apache2# grep -Ri access.log
[unrelated stuff]
sites-available/default-ssl.conf: CustomLog ${APACHE_LOG_DIR}/access.log combined
sites-available/000-default.conf: CustomLog ${APACHE_LOG_DIR}/access.log combined
sites-enabled/000-default.conf: CustomLog ${APACHE_LOG_DIR}/access.log combined
Thanks @qedrakmar !
I just added RUN rm /var/log/apache2/access.log to my Dockerfile which fixed it - thanks :)
Most helpful comment
Thanks @qedrakmar !
I just added
RUN rm /var/log/apache2/access.logto my Dockerfile which fixed it - thanks :)