powershell: [BUG] Set-PnPTraceLog: log file is empty
Reporting an Issue or Missing Feature
When use Set-PnPTraceLog (PnP.PowerShell 1.7.0) output log file is empty:
Set-PnPTraceLog -On -LogFile "output.log" -Level Debug
Expected behavior
Output log file is not empty and contains logging information from PnP.PowerShell cmdlets.
Actual behavior
Output log is empty.
Steps to reproduce behavior
Please include complete script or code samples in-line or linked from gists
What is the version of the Cmdlet module you are running?
PnP.PowerShell 1.7.0
Which operating system/environment are you running PnP PowerShell on?
- [ x] Windows
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 18 (1 by maintainers)
Commits related to this issue
- #1061 - potentially fixing trace log issue — committed to gautamdsheth/powershell by gautamdsheth 5 years ago
- #1061 - potentially fixing Set-PnPTraceLog issue (#1128) * Downgraded dependencies to handle Az DLLs * Fix #916 - added PnP alias for commands * Added SiteAlias for New-PnPSite, Principals for ... — committed to pnp/powershell by gautamdsheth 5 years ago
- Fix #1155 - issue with M365 groups image (#1157) * Downgraded dependencies to handle Az DLLs * Fix #916 - added PnP alias for commands * Added SiteAlias for New-PnPSite, Principals for PnPHubSi... — committed to pnp/powershell by gautamdsheth 5 years ago
- Removed alias cmdlets which we were supposed to remove in 1.5.0 (#1191) * Downgraded dependencies to handle Az DLLs * Fix #916 - added PnP alias for commands * Added SiteAlias for New-PnPSite, ... — committed to pnp/powershell by gautamdsheth 5 years ago
- Updated changelog (#1192) * Downgraded dependencies to handle Az DLLs * Fix #916 - added PnP alias for commands * Added SiteAlias for New-PnPSite, Principals for PnPHubSite * Updated docs ... — committed to pnp/powershell by gautamdsheth 5 years ago
Any updates on this issue? I do not get trace logs in the console using the command Invoke-PnPSiteTemplate using version 1.7.0 or 1.8.0.
Merci @ygrenier ! Ok it’s in the build script that changes were done. I wasnt looking at the right place! So if using Build-Debug.ps1 locally, it fixes temporarily the problem…
I had an idea.
PnP.PowerShell use the PnP.Framework.Diagnostics.TraceLogger (from the PnP.Framework.dll) wich using the System.Diagnostic.Trace class.
In the PnP.Framework project I see in the Release configuration the TRACE variable is not defined, so because the ConditionalAttribute on the Trace class, the code calling Trace methods is not generated.
I tested with building a new PnP.Framework.dll with the TRACE variable enabled, and my log files are filled.
I don’t know how to report this feedback ?
Regards
I’ve been watching this issue closely because I’ve also encountered the problem. Sadly, it looks to me like something prior to the 1.8 release reverted back to creating empty log files. Here is the sample block that I used to quickly cycle through a few different versions:
My test results were as follows: 1.7.58-nightly - works as expected 1.7.59-nightly - works as expected 1.7.60-nightly - Yields empty log file 1.7.69-nightly - Yields empty log file 1.8.0 - Yields empty log file 1.8.12-nightly - Yields empty log file
I didn’t take the time to test all the nightly builds between 1.7.60 and 1.8.0 as the pattern seems relatively clear. Hopefully this helps. I’m eager to see the trace log functionality appear in a LTS build. Thanks for the help!