You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
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
The text was updated successfully, but these errors were encountered: