Repository navigation
Fix memory leak: install module logger before the application is built #147
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
Open
samdark
wants to merge
9
commits into
Codeception:master
Choose a base branch
from
samdark:fix-issue-78-logger-order
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
971b39e
Install module logger before building the application in startApp()
samdark 5a3644d
Restore module logger after application bootstrap
samdark bfb1f63
Defer yii\log shutdown registrations and run them on application reset
samdark c3d61e7
Store deferred shutdown args as a list
samdark 9facd8c
Address review findings on deferred shutdown handling
samdark 2d0e029
Support the modernized yii2-app-advanced template in tests
samdark dd5f5f2
Make the test suite pass PHPStan 2.3.x
samdark 8b4b342
Exclude generated actor actions from PHPStan and clean the mailer bin…
samdark 6039a30
Regenerate the PHPStan baseline against the rebuilt actor actions
samdark 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,11 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace app\bootstrapLogger; | ||
|
|
||
| use yii\web\Application as BaseApplication; | ||
|
|
||
| final class App extends BaseApplication | ||
| { | ||
| } |
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,20 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace app\bootstrapLogger; | ||
|
|
||
| use yii\log\Logger as YiiLogger; | ||
|
|
||
| /** | ||
| * A standalone global logger installed by the application's bootstrap callback. | ||
| * It overrides `init()` (as the module logger does) only to avoid the unrelated | ||
| * shutdown-registration retention root; the point is that the app replaces the | ||
| * global logger while it is being built. | ||
| */ | ||
| final class CustomLogger extends YiiLogger | ||
| { | ||
| public function init(): void | ||
| { | ||
| } | ||
| } |
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,12 @@ | ||
| paths: | ||
| tests: . | ||
| output: ../../_output | ||
| data: _data | ||
| support: ../../_support | ||
| namespace: tests\ | ||
| modules: | ||
| config: | ||
| Yii2: | ||
| configFile: config.php | ||
| transaction: false | ||
| cleanup: false |
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,23 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| require_once __DIR__ . '/app/App.php'; | ||
| require_once __DIR__ . '/app/CustomLogger.php'; | ||
|
|
||
| return [ | ||
| 'class' => app\bootstrapLogger\App::class, | ||
| 'id' => 'bootstrap-logger', | ||
| 'basePath' => __DIR__, | ||
| 'bootstrap' => [ | ||
| static function (): void { | ||
| \Yii::setLogger(new \app\bootstrapLogger\CustomLogger()); | ||
| }, | ||
| ], | ||
| 'components' => [ | ||
| 'request' => [ | ||
| 'cookieValidationKey' => 'bootstrap-logger', | ||
| 'enableCsrfValidation' => false, | ||
| ], | ||
| ], | ||
| ]; |
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,7 @@ | ||
| actor: FunctionalTester | ||
| modules: | ||
| enabled: | ||
| - Yii2 | ||
| - Asserts | ||
| steps: | ||
| - Codeception\Step\ConditionalAssertion |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.