Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@dantraMSFT

Description

@dantraMSFT
Issue body actions

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
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.