CMTrace not showing log information correctly

I’ve noticed when viewing PSAppDeploy logs in the CMTrace format, the component, date/time and thread columns do not populate information.

Further research has pointed me to an issue with how the time tag is written. I’m in the PST timezone, PSAppDeploy writes the time tag as:

<time=“10:49:09.135-480”

However, if I look at regular CCM logs produced by SCCM, the time tag is written as:

<time=“10:49:09.135+480”

Indeed if I manually modify the PSAppDeploy logs to find/replace all ‘-480’ with +480 and save the changes, full details are then displayed in CMTrace.

This is not a huge issue for me, but I thought I would bring this to the attention of the developers in case anyone else is also seeing the same in their logs.

Are you using the latest version of CMTrace.exe to open the log file? The older version does not open the SCCM 2012 CMTrace log format correctly.

I’m currently using this version: 5.0.7711.0000 (64-bit)

What version should I be using?

The version that came with SCCM 2012. I have version 5.0.7804.1000.

Ok, yup, that was the problem. I had an old copy of CMTrace. After replacing with the latest version, I can now see full details in the PSAppDeploy logs.

1 Like

Bringing life to this thread.

I’m experiencing this issue on Windows 10.0.10586, and CMTrace version 5.0.8230.1000.

In the log the Component column and the Date/Time column is blank and when marking a line the date/time in the info pane is set to 01.0.1601 00.00.00.

Is anyone dealing with this issue?

Script version: 3.6.8

Replace “[string]LogTime = (Get-Date -Format 'HH\:mm\:ss.fff').ToString()" with "(Get-Date -Format HH:mm:ss).$((Get-Date).Millisecond)+000” in AppDeployToolkitMain.ps1

Script Version: 3.8.2
Line no. 701
[string]LogTime = "(Get-Date -Format HH:mm:ss).$((Get-Date).Millisecond)+000"

This is still happening in 3.9.0.
And the issue comes from the way the timestamp is created by the Write-Log function.
A working version of the time stamp, from SCCM logs, looks like this:
<time=“11:54:29.015-120”
While PSADT Write-Log function writes the time like this:
<time=“10:13:16.107”

And the issue, I believe, comes from this section of the Write-Log function:


This line:

[String]$LogTimePlusBias = $LogTime + $script:LogTimeZoneBias

Should be like this:

[String]$LogTimePlusBias = $LogTime + '-' + $script:LogTimeZoneBias

Well, it looks like that change is not enough. Now, I am getting this in the logs:
<time=“00:21:25.412-” date=“01-24-2023”
I pasted the code in the screenshot above directly in PowerShell and it works:

So I don’t know why, in the logs, the $script:LogTimeZoneBias variable turns out empty.

L.E.

I played a bit more with this and I made it work with this code:

        If (-not (Get-Variable 'LogTimeZoneBias' -Scope 'Script' -ErrorAction 'Ignore')) {
            [Int32]$script:LogTimeZoneBias = [TimeZone]::CurrentTimeZone.GetUtcOffset($DateTimeNow).TotalMinutes
        }
        [String]$LogTimePlusBias = $LogTime + '-' + $script:LogTimeZoneBias

It looks like, for some reason, using Test-Path to see if the variable exists or not fails, at least for me.
And the ‘-’ is also needed in building the $LogTimePlusBias variable.