This repository was archived by the owner on Nov 27, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add hello world command to demo bundle and configure new log to console handler #557
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,5 @@ monolog: | |
type: stream | ||
path: %kernel.logs_dir%/%kernel.environment%.log | ||
level: debug | ||
console: | ||
type: console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Acme\DemoBundle\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
* Hello World command for demo purposes. | ||
* | ||
* You could also extend from Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand | ||
* to get access to the container via $this->getContainer(). | ||
* | ||
* @author Tobias Schultze <http://tobion.de> | ||
*/ | ||
class HelloWorldCommand extends Command | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure() | ||
{ | ||
$this | ||
->setName('acme:hello') | ||
->setDescription('Hello World example command') | ||
->addArgument('who', InputArgument::OPTIONAL, 'Who to greet.', 'World') | ||
->setHelp(<<<EOF | ||
The <info>%command.name%</info> command greets somebody or everybody: | ||
|
||
<info>php %command.full_name%</info> | ||
|
||
The optional argument specifies who to greet: | ||
|
||
<info>php %command.full_name%</info> Fabien | ||
EOF | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$output->writeln(sprintf('Hello <comment>%s</comment>!', $input->getArgument('who'))); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this increases performance so the firephp and chromephp handler are not executed for console commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the meaning of "bubble" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/Seldaek/monolog#core-concepts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello.
I just hit an issue here with bubble and I would like to discuss about it
I was trying to debug my application, and so I added a new handler to push all my logs to the Elasticsearch/Heka/Kibana stack (to get a better visualisation / filter system for my logs...) . I did not really think about the order of the handlers and so I added my new handler after the previous handlers. And so I ended-up with the following config:
After that, I tried to debug my code and noticed I missed lot of logs. I try to understand why (is it an issue with ES or heka or kibana ? ; It is an issue with my code ? ; etc ?). And I finally understood my issue.
So finally, I really think the console handler should bubble all logs, because It's "just" a nice to have feature (A very good one BTW, thanks again). But it should not "eat" logs. All handlers registered after the handler should also be able to get all logs. So, IMHO, we should turn on the bubble here.
WDTY ?
ping @Tobion @Seldaek
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesnt really matter if bubble is enabled or not as the firephp and chromephp handler are not enabled anymore by default in SE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tobion Yes I know and my "issue" was not about firephp. It was about DX ; to remove a possible WTF effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel free to change it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already changed it in my app ; But I wanted to know if you think it's a good idea to change it in symfony too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok to change it