New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Logger stdout configurable using env variables #10901

Merged
merged 2 commits into from Oct 8, 2018

Conversation

Projects
None yet
4 participants
@mickaelandrieu
Contributor

mickaelandrieu commented Oct 8, 2018

Questions Answers
Branch? 1.7.5.x
Description? You may want to change the output path using the environment variable instead of updating the configuration files. Use LOG_STDOUT to define a new Logger output.
Type? improvement
Category? BO
BC breaks? no
Deprecations? no
How to test? Setup the LOG_STDOUT environment variable and check if the logger output has been updated. IMHO, @Quetzacoalt91 is the best one to review this one.

This change is Reviewable

@@ -10,6 +10,8 @@ parameters:
translator.class: PrestaShopBundle\Translation\Translator
translator.data_collector: PrestaShopBundle\Translation\DataCollectorTranslator
admin_page: "%kernel.root_dir%/../src/PrestaShopBundle/Resources/views/Admin"
log_stdout: '%env(LOG_STDOUT)%'
env(LOG_STDOUT): "%kernel.logs_dir%/%kernel.environment%.log"

This comment has been minimized.

@PierreRambaud

PierreRambaud Oct 8, 2018

Contributor

LOG_STDOUT is too generic for the system. Should be PS_LOG_STDOUT instead

This comment has been minimized.

@mickaelandrieu

mickaelandrieu Oct 8, 2018

Contributor

yes, but I need to keep PS_* available for ... configuration keys later. How about _PS_LOG_STDOUT ?

This comment has been minimized.

@PierreRambaud

PierreRambaud Oct 8, 2018

Contributor

And more, because it's not only an stdout log (stderr too), PS_LOG_OUTPUT can be used?

@PierreRambaud PierreRambaud added this to the 1.7.5.0 milestone Oct 8, 2018

@PierreRambaud

This comment has been minimized.

Contributor

PierreRambaud commented Oct 8, 2018

@Quetzacoalt91 you can try too =)

@Quetzacoalt91

This comment has been minimized.

Member

Quetzacoalt91 commented Oct 8, 2018

All good, I tried with this configuration.

version: '2'

volumes:
    db-data:

services:
    mysql:
        image: mysql:5.6
        ports:
            - "3306"
        volumes:
            - db-data:/var/lib/mysql
        environment:
            MYSQL_ROOT_PASSWORD: password
            MYSQL_DATABASE: prestashop
    apache:
        image: prestashop/prestashop-git:7.1
        environment:
            PS_INSTALL_AUTO: 1
            DB_PASSWD: password
            DB_NAME: prestashop
            DB_SERVER: mysql
            PS_DOMAIN: localhost:8001
            PS_FOLDER_INSTALL: install-dev
            PS_FOLDER_ADMIN: admin-dev
            _PS_LOG_OUTPUT_: "php://stdout"
        ports:
            - "8001:80"

The container log is now filled with additional details.

[2018-10-08 16:29:49] doctrine.DEBUG: SELECT t0.id_tab AS id_tab_1, t0.id_parent AS id_parent_2, t0.position AS position_3, t0.module AS module_4, t0.class_name AS class_name_5, t0.active AS active_6, t0.hide_host_mode AS hide_host_mode_7, t0.icon AS icon_8 FROM ps_tab t0 WHERE t0.class_name = ? LIMIT 1 ["AdminDashgoals"] []
[2018-10-08 16:29:56] doctrine.DEBUG: SELECT t0.id_tab AS id_tab_1, t0.id_parent AS id_parent_2, t0.position AS position_3, t0.module AS module_4, t0.class_name AS class_name_5, t0.active AS active_6, t0.hide_host_mode AS hide_host_mode_7, t0.icon AS icon_8 FROM ps_tab t0 WHERE t0.class_name = ? LIMIT 1 ["AdminLinkWidget"] []
[2018-10-08 16:30:03] doctrine.DEBUG: SELECT t0.id_tab AS id_tab_1, t0.id_parent AS id_parent_2, t0.position AS position_3, t0.module AS module_4, t0.class_name AS class_name_5, t0.active AS active_6, t0.hide_host_mode AS hide_host_mode_7, t0.icon AS icon_8 FROM ps_tab t0 WHERE t0.class_name = ? LIMIT 1 ["AdminWelcome"] []
@Quetzacoalt91

This comment has been minimized.

Member

Quetzacoalt91 commented Oct 8, 2018

As said to @mickaelandrieu, I'm not confortable with the use of _PS_[...] env var, as they differ from the existing format.

@PierreRambaud PierreRambaud merged commit bce8f3f into PrestaShop:1.7.5.x Oct 8, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@PierreRambaud

This comment has been minimized.

Contributor

PierreRambaud commented Oct 8, 2018

No need QA here. Thanks @mickaelandrieu

@PierreRambaud PierreRambaud deleted the mickaelandrieu:make-log-stdout-configurable branch Oct 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment