Skip to content

Commit

Permalink
Add logging in Docker to log to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
quartje committed Jan 30, 2024
1 parent ffa3d3a commit cc190d7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
14 changes: 9 additions & 5 deletions docker/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
FROM ghcr.io/openconext/openconext-basecontainers/php72-apache2:latest AS php-build
COPY *.tar.bz2 /tmp/
RUN tar -xvjf /tmp/*.tar.bz2 -C /var/www/html/ && \
rm -rf /tmp/*.tar.bz2
FROM ghcr.io/openconext/openconext-basecontainers/php72-apache2:latest
COPY ./*tar.gz /tmp/
RUN tar --strip-components=1 -xvzf /tmp/*tar.gz -C /var/www/html/ && \
rm -rf /tmp/*.tar.gz

# Add the config files for Apache2
RUN rm -rf /etc/apache2/sites-enabled/*
COPY ./docker/php-fpm/apache2.conf /etc/apache2/sites-enabled/apache2.conf
COPY ./docker/conf/engine.conf /etc/apache2/sites-enabled/engine.conf
COPY ./docker/conf/logging.yml /var/www/html/app/config/
RUN mkdir /var/www/html/app/cache && \
chmod -R 777 /var/www/html/app/cache/ && \
chmod 777 /var/www/html/app/logs/

# Set the default workdir
WORKDIR /var/www/html
Expand Down
22 changes: 22 additions & 0 deletions docker/conf/logging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
monolog:
channels: ["%logger.channel%", "authentication"]
handlers:
main:
type: fingers_crossed
activation_strategy: engineblock.logger.manual_or_error_activation_strategy
passthru_level: "%logger.fingers_crossed.passthru_level%"
handler: stderr
channels: ["!authentication"]
stderr:
type: stream
path: php://stderr
ident: "%logger.syslog.ident%"
formatter: engineblock.logger.additional_info_formatter
authentication:
type: stream
path: php://stderr
ident: EBAUTH
facility: user
level: INFO
channels: [authentication]
formatter: engineblock.logger.formatter.syslog_json

0 comments on commit cc190d7

Please sign in to comment.