Skip to content

Fixed logger processor example #8226

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 1 commit into from
Sep 3, 2017
Merged

Conversation

HeahDude
Copy link
Contributor

Fixes #7897.

@HeahDude HeahDude added the bug label Jul 25, 2017
@HeahDude HeahDude added this to the 2.7 milestone Jul 25, 2017
@@ -59,8 +59,8 @@ using a processor.
arguments:
- "[%%datetime%%] [%%extra.token%%] %%channel%%.%%level_name%%: %%message%% %%context%% %%extra%%\n"

monolog.processor.session_request:
class: AppBundle\SessionRequestProcessor
app.logger.session_request_processor:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be an FQCN from 3.3

use Monolog\Formatter\LineFormatter;

$container
->register('monolog.formatter.session_request', LineFormatter::class)
->addArgument('[%%datetime%%] [%%extra.token%%] %%channel%%.%%level_name%%: %%message%% %%context%% %%extra%%\n');

$container
->register('monolog.processor.session_request', SessionRequestProcessor::class)
->register('app.logger.session_request_processor', SessionRequestProcessor::class)
->addArgument(new Reference('session'))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

'session' should be SessionInterface::class from 3.3

$this->sessionId = substr($this->session->getId(), 0, 8) ?: '????????';
}

$record['extra']['token'] = $this->sessionId.'-'.substr(uniqid(), -8);
Copy link
Member

Choose a reason for hiding this comment

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

we should pass true as the second argument to uniqid()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, done!

@HeahDude HeahDude force-pushed the fix/log-processing branch from f51156a to 24ddb64 Compare July 27, 2017 09:22
@xabbuh
Copy link
Member

xabbuh commented Sep 3, 2017

Thank you @HeahDude.

@xabbuh xabbuh merged commit 24ddb64 into symfony:2.7 Sep 3, 2017
xabbuh added a commit that referenced this pull request Sep 3, 2017
This PR was merged into the 2.7 branch.

Discussion
----------

Fixed logger processor example

Fixes #7897.

Commits
-------

24ddb64 Fixed logger processor example
@HeahDude HeahDude deleted the fix/log-processing branch September 3, 2017 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants