Turn on Windows Event logging for Lync

 

 

Registry locations

HKCU\Software\Microsoft\Communicator\EnableEventLogging

Allowed registry values

· 0 – Lync will not log events to the Application event log

· 1 – Lync will log events to the Application event log

Registry value type

REG_DWORD

Default setting

0: Lync events are not recorded to the Application event log

 

Can Microsoft Lync record events (in particular, information about failed calls) to the Application event log? You bet it can: all you have to do is ask.

 

Wait, we take that back: you’ll probably have more success if you specifically enable event logging in Lync as opposed to merely asking Lync if it could start logging events for you. (We're still working on that "Ask Lync to do something and it'll just do it for you" feature.) Fortunately, it’s very easy to enable (or disable) event logging; all you have to do is select the Turn on Windows Event logging for Lync checkbox, a checkbox found under the General options of the Options dialog box:

 

 

It’s also very easy to enable (or disable) event logging by modifying the registry: in that case you just need to change the HKCU\SOFTWARE\Microsoft\Communicator\EnableEventLogging registry value. Set this value to 1 and Lync will start recording events to the Application event log. Set this value to 0 and Lync will not record events to the Application event log.

 

See? All you had to do was ask.

 

Well, that and modify the EnableEventLogging registry value.

 

Before we go much further we should point out that certain events – in particular, events having to do with connection failures – are recorded in the event log regardless of whether event logging has been enabled or disabled. For example, suppose you start Lync and are unable to connect to Lync Server. In that case, messages similar to these will be recorded to the event log:

 

  • Lync failed to connect to server atl-sip-001.fabrikam.com (192.168.1.1) on port 5061 due to error 10065. The server is not listening on the port in question, the service is not running on this machine, the service is not responsive, or network connectivity doesn't exist.

  • Lync was unable to resolve the DNS hostname of the login server atl-sip-001.fabrikam.com.

 

Etc. However, what isn't logged in the event log (unless you enable this feature) is detailed diagnostic information about failed calls. If you disable event logging then nothing gets logged if you're involved in a failed call. But if you do enable event logging, then each failed call will result in event log entries similar to this:

 

 

That's pretty useful information if you're trying to figure out why a call failed.

 

Note. Actually we should qualify that statement a little: that's useful information if you haven't deployed Monitoring Server and Monitoring Server Reports. If you're using Monitoring Server you don't need to record failed call events in the event log: instead, all that information will automatically be forwarded to Monitoring Server itself. That's nice, because all the information about all your failed calls will be in one place, without having to retrieve this data from the event logs on all your client machines.

 

We should also point out that client policies have a property (EnableEventLogging) that deals with event logs. If you set the value of this property to False, then failed calls will not be logged to the event log. In addition to that, the option for enabling/disabling event logging will no longer be available in Lync:

 

Note. And how do you set that client policy property to False? Like this:

 

Set-CsClientPolicy –Identity global –EnableEventLogging $False

 

So what happens if you set EnableEventLogging to True (or, in PowerShell-speak, $True)? You got it: event logging will be enabled, and users will not be able to change that setting:

 

 

As you can see, the client policy always trumps whatever value might be set in the registry. Because of that, if you're wondering whether event logging has been enabled for a given user, the first place to check is that user's client policy. If no value has been configured for the EnableEventLogging property you can then use the following PowerShell script to retrieve the current value of EnableEventLogging on 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 how you do that:

 

$computer = "."

 

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

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

 

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

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

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

Write-Host "Turn on Windows event logging for Lync: $value"

 

And, of course, there's also a way to set the value of EnableEventLogging. The following script enables event logging; that's done by setting EnableEventLogging to 1. To disable event logging, set EnableEventLogging to 0:

 

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

 

Like this:

 

$computer = "."

 

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

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

 

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