Turn logging on in Lync

 

 

Registry locations

HKCU\Software\Microsoft\Communicator\EnableTracing

Allowed registry values

· 0 – Tracing is not enabled in Lync

· 1 – Tracing is enabled in Lync

Registry value type

REG_DWORD

Default setting

0: Tracing is not enabled in Lync

 

As you probably know, Microsoft Lync has the ability to keep an enormous amount of information about everything it does and, perhaps more importantly, anything that might go wrong when it tries to do whatever it does. Needless to say, this information can be incredibly useful when troubleshooting Lync-related problems: there's no real substitute for having multiple log files that pretty much let you recreate a Lync session, SIP message by SIP message. These logs also let you know all the settings and restrictions that were in force when Lync was used. For example, the file Communicator-uccapi-0.uccapilog shows you all the policy settings that were applied when the user connected to Lync Server:

 

<provisionGroup name="presencePolicyV2" >

    <propertyEntryList >

        <property name="EnablePrivacyMode" >false</property>

        <property name="AutoInitiateContacts" >true</property>

        <property name="PublishLocationDataDefault" >true</property>

        <property name="DisplayPublishedPhotoDefault" >true</property>

        <property name="PersonalNoteHistoryDepth" >3</property>

        <property name="SubscribeToCollapsedDG" >false</property>

    </propertyEntryList>

</provisionGroup>

 

Pretty cool, huh?

 

By default, this type of logging (also known as tracing) is disabled on Microsoft Lync. Considering the vast amount of information that's made available to you, why would you ever want to disable tracing in Microsoft Lync?

 

Well, believe it or not, there are several reasons. For one thing, a lot of the information is of minimal use (if it's even of any use) to a system administrator. For example, take this small snippet extracted from one of the log files:

 

05/17/2011|10:27:26.701 1978:12E0 TRACE :: CSIPAsyncSocket::Send this 07FB9E90, sending pbSendBuf 05165070, dwSendBufSize = 154

05/17/2011|10:27:26.701 1978:12E0 TRACE :: CSIPAsyncSocket::SendHelper - [0x07FB9E90]

05/17/2011|10:27:26.701 1978:12E0 TRACE :: CSIPAsyncSocket::SendHelper this 07FB9E90, pbSendBuf 05165070, dwSendBufSize = 154, dwBytesSent = 154

05/17/2011|10:27:26.709 1978:12E0 TRACE :: CSIPTransportLayerNotify::OnRecv - [0x07FB9E98]

 

Unless you actually wrote the code for Microsoft Lync, thousands of lines like those might not be all that informative.

 

In addition, log files can quickly consume enormous amounts of disk space. For example, when the author of this article started Microsoft Lync this morning (with tracing enabled), he hit a snag: Lync was unable to connect to the server. Fortunately, after just a few seconds, he was able to get through and make the connection after all. However, that brief 3- or 4-second little snag generated over 72 megabytes worth of log files.

 

And yes, that is a lot.

 

Finally, while there is definitely useful troubleshooting information to be found in the log files, much of troubleshooting data of interest/use to system administrators can be gathered by using Monitoring Server. Even better, if you use Monitoring Server and Monitoring Server Reports you can quickly and easily view and analyze this information, much quicker and easier than you could by wading through gigabytes of client log files.

 

But you know what? It's entirely up to you whether or not you want to enable tracing in Microsoft Lync. Either way, you can manage this option by selecting (or deselecting) the Turn on logging in Lync option:

 

 

And before you ask, of course you can manage this setting using Windows PowerShell; all you have to do is manipulate the HKCU\SOFTWARE\Microsoft\Communicator\EnableTracing registry value. For example, the following PowerShell script retrieves the current value of EnableTracing from the local computer. If you'd prefer to retrieve this value from a remote computer, simply set the value of the variable $computer to the name of that remote computer. For example:

 

$computer = "atl-ws-001.litwareinc.com"

 

Here's the script for retrieving the value:

 

$computer = "."

 

$registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("CurrentUser", $computer)

$key = $registry.OpenSubKey("SOFTWARE\Microsoft\Communicator", $True)

 

$value =$key.GetValue("EnableTracing",$null)

if ($value -eq 1) {$value = "Yes"}

if ($value -eq 0) {$value = "No"}

Write-Host "Turn logging on in Lync: $value"

 

And what if you want to change the value of EnableTracing? Hey, no problem. The following script enables tracing; that's done by setting EnableTracing to 1. To disable tracing, set EnableTracing to 0:

 

$key.SetValue("EnableTracing",0,"DWORD")

 

Like this:

 

$computer = "."

 

$registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("CurrentUser", $computer)

$key = $registry.OpenSubKey("SOFTWARE\Microsoft\Communicator", $True)

 

$key.SetValue("EnableTracing",1,"DWORD")

 

Keep in mind that there's also a client policy setting – EnableTracing – that can be used to manage tracing. If EnableTracing is set to True in a user's client policy the tracing will be enabled and the user will not be able to change that setting:

 

It doesn't matter how the registry has been configured: the client policy setting always takes precedence over the registry setting.

 

Likewise, if the client policy's EnableTracing setting has been set to False then tracing will be disabled and the user will not be able to enable it.