10000 Logging is initialized before the configuration file is processed. · Issue #6085 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Logging is initialized before the configuration file is processed. #6085

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

Closed
dantraMSFT opened this issue Feb 1, 2018 · 0 comments · Fixed by #6025
Closed

Logging is initialized before the configuration file is processed. #6085

dantraMSFT opened this issue Feb 1, 2018 · 0 comments · Fixed by #6025
Assignees
Labels
Issue-Bug Issue has been identified as a bug in the product Resolution-Fixed The issue is fixed.

Comments

@dantraMSFT
Copy link
Contributor

On Unix systems (Linux and MacOS), PowerShell logging can be customized using the -settingsFile command-line option and it is assumed the file is processed before any logging occurs.

On recent builds, this is no longer the case and logging is being initialized before the logging overrides are read from the configuration file resulting in logging using the default values.

Note that logging initialization is currently through static constructors and any reference to the associated classes can cause initialization to occur. As a result, logging initialization is non-deterministic and can occur before logging overrides are processed.

Steps to reproduce

Create a powershell.config.json with a single configuration setting "LogIdentity": "CustomPWSH"
Launch PowerShell with -settingsFile powershell.config.json

Expected behavior

On Linux, PowerShell logs all events using the identity 'CustomPWSH'

Actual behavior

PowerShell logs all events using the default identity 'powershell'

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.1
PSEdition                      Core
GitCommitId                    v6.0.1
OS                             Linux 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23)
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@dantraMSFT dantraMSFT added the Issue-Bug Issue has been identified as a bug in the product label Feb 1, 2018
@dantraMSFT dantraMSFT self-assigned this Feb 1, 2018
@dantraMSFT dantraMSFT changed the title Logging is occurring before the configuration file is processed. Logging is initialized before the configuration file is processed. Feb 1, 2018
@iSazonov iSazonov added the Resolution-Fixed The issue is fixed. label Mar 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Issue has been identified as a bug in the product Resolution-Fixed The issue is fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0