Skip to content

Add logging configuration to the symfony sample #556

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

Merged
merged 10 commits into from
Feb 22, 2018
Merged

Conversation

tmatsuo
Copy link
Contributor

@tmatsuo tmatsuo commented Feb 20, 2018

No description provided.

Copy link
Contributor

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! However I think we need to make this it's own section in the README and change a few things! Also I think it'd be great to have tests that actually verify logging/exception handling.

@@ -20,6 +20,13 @@ Use composer to download Symfony Standard and its dependencies
composer create-project symfony/symfony:^3.0
```

# Add dependency
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be more clear as Add Composer Dependencies, but this enhancement would be better as a second section of the README, marked # Integrate Stackdriver

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (with the next commit)

@@ -31,13 +38,15 @@ git clone https://github.com/GoogleCloudPlatform/php-docs-samples /path/to/php-d

# copy the two files below to the root directory of your Symfony project
cd /path/to/php-docs-samples/appengine/flexible/symfony/
cp ./{app.yaml,nginx-app.conf} /path/to/symfony
cp app.yaml app/config/config_prod.yml \
src/AppBundle/EventSubscriber/ExceptionSubscriber.php /path/to/symfony
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't going to work because it will copy these files into the root of their project, and so ExceptionSubscriber.php will not be autoloaded, and config_prod.yaml will not be in the config directory.

It would be better to add ExceptionSubscriber to our client libraries, or instead of copying it over, explain in this tutorial how to add the exception Subscriber in symfony, and link to this doc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the next commit

@tmatsuo
Copy link
Contributor Author

tmatsuo commented Feb 21, 2018

@bshaffer Ready for another look. The deployment test is passing locally

cp app.yaml /path/to/symfony
cp app/config/config_prod.yml /path/to/symfony/app/config
cp src/AppBundle/EventSubscriber/ExceptionSubscriber.php \
/path/to/symfony/src/AppBundle/EventSubscriber
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By following this tutorial, the app won't have an AppBundle/EventSubscriber directory. So we'll need to add a step to create that directory. Also, I would think we'd need to add AppBundle to composer.json for autoloading, but strangely the tests do not seem to do that, so I'm not totally sure how that class is being loaded and integrated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a line for mkdir. The file is automatically loaded by symfony.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I missed it. Let's call out "Create a directory for the Exception Subscriber" in a comment and separate it from "copy the three files"

Looking at the composer.json generated by symfony, I do not see anywhere that autoloading would occur.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bshaffer Done for the README.

It's automatically loaded. See:
http://symfony.com/doc/3.4/event_dispatcher.html

That's it! Your services.yml file should already be setup to load services from the EventSubscriber directory. Symfony takes care of the rest.

Copy link
Contributor

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@tmatsuo tmatsuo merged commit 01568d4 into master Feb 22, 2018
@bshaffer bshaffer deleted the symfony-logging branch May 23, 2018 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants