How to Disable Outlook Logging and Remove the files

Outlook comes with a logging feature which is primarily used to troubleshoot Outlook-related problems. But when turned on, Outlook Logging can consume a lot of disk space. So how can we disable it and clean up the log files?

The logging feature in Outlook is rarely used, so it’s recommended to keep the feature turned off by default. You should only enable it for a short period of time when troubleshooting Outlook-related issues. Even though it’s turned off, I have seen a lot of cases where the log files are generated nevertheless.

In this article, I will explain how you can turn the Outlook logging feature off, show you a trick to prevent the generation of the ETL log files, and explain how you can remove the log files easily with PowerShell.

What is Outlook Logging

When you have returning issues with emails that are not sent or other issues in Outlook, then you can enable the troubleshooting logging feature in Outlook. This will generate a log file, which is stored in your local appdata temp folder %temp%\Outlook Logging. The file, generally named OPMLog.log, can be opened with notepad and will show you a transaction log of all steps Outlook performed to send and receive your mail.

The transaction log can be enabled in Outlook:

  1. Click on File > Options
  2. Select Advanced and scroll a bit down
  3. Check Enable troubleshooting logging to enable the transaction log
Outlook Logging

You will need to restart Outlook to enable the transaction log. When the feature is enabled, you will get a warning in the lower right corner when you open Outlook that logging is enabled.

logging enabled warning
Outlook Logging Enabled

To view the log file, open the explorer and navigate to %temp%\Outlook Logging. Here you will find a file OPMLog.log with the transaction log.

ETL Files in Outlook Logging

Besides the normal .log files, you will probably also find .ETL files in the folder. These files contain event logs that are generated by the Windows system kernel. ETL files are used to analyze and troubleshoot application-level problems. It’s possible to open the files with the event viewer, using the import function on the right side. But you won’t get much useful information out of it.

The problem with the ETL files is that they are quite big, often 51.200KB each, and they are not getting cleaned up automatically. So this can easily result in multiple GB of disk space that is being used by the obsolete log files.

ETL Log file Outlook Logging
ETL files in Outlook Logging

At the moment it’s still unclear why the files are generated. It definitely hasn’t anything to do with the Troubleshooting Logging feature in Outlook. I have seen some reports that a miss configured mailbox in Outlook can cause the creation of the ETL log files. In these cases the clients had multiple mailboxes configured in Outlook and one of them wasn’t accessible anymore. Removing the mailbox in question from the Outlook profile solved the issue.

But the general feeling at the moment is that this is just a bug in Outlook that Microsoft hasn’t addressed yet.

All options for Disabling Outlook Logging

So before we are removing the ETL files, let’s make sure that we have checked every option to disable the Outlook logging. We are going to check the following options:

  • Disable Troubleshooting logging in Outlook Options
  • Check and set a couple of registry keys
  • Disable Enterprise logging
  • Check Group Policy

Disable Troubleshooting logging

The first and most obvious step is to disable the troubleshooting logging feature in Outlook Options.

  1. Open Outlook
  2. Click on File > Options
  3. Select Advanced and scroll a bit down
  4. Uncheck Enable troubleshooting logging to disable the logging
Disable Outlook Logging
Disable Outlook Logging

Check and set a couple of registry keys

There are a couple of registry keys that we can use the enable or disable the logging feature. Open the Windows Registry by pressing the Windows Key + R, type regedit, and press enter.

Navigate to HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Options\Mail
and make sure that the value EnableLogging is set to 0 or doesn’t exist.

We can also add EnableETWLogging and set it to 0, conform this support article, but that also didn’t stop the ETL file creation.

enablelogging registry

Navigate to Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Logging
and create a new DWORD_32Bit value named DisableDefaultLogging and set it to 1

Disable Enterprise logging

Enterprise logging collects more information than the normal logging option in Outlook. To make sure that Enterprise logging isn’t configured, we need to check the existing and remove the following registry key:

Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\Logging
make sure that the following value is removed: EnableLogging

Check Group Policy

The troubleshooting log can also be enabled using a group policy. Group policies are used by IT departments to easily manage settings on all computers in a domain. If your computer isn’t part of a domain, then there is no need to check the setting.

You can set the logging policy in

User Configuration \ Policies \ Administrative Templates \ Microsoft Outlook 2016 \ Outlook Options \ Other \ Advanced

Make sure that Enable mail logging (troubleshooting) is not configured or disabled.

Prevent ETL files generation

I have tested all options above, and even more, and still, the ETL files are generated when opening Outlook. There is however an option (trick) to prevent Outlook from creating the ETL files.

  1. Open the local AppData folder (type %localappdata% in the explorer)
  2. Open the Temp folder
  3. Delete the folder Outlook Logging
  4. Create a new text file and name it Outlook Logging. Make sure that you remove the extension .txt from the file name

This way, Outlook won’t be able to create the folder “Outlook Logging” and also won’t be able to write the ETL files. Removing the folder doesn’t seem to cause any other issues with Outlook.

Cleanup Outlook Logging Script

We can use PowerShell to quickly remove all ETL files and even the complete Outlook Logging folder from the clients. The script below will go through all user’s folders, check if the folder exists, and remove it.

After the content is removed, it will create the “dummy” file to prevent the creation of new ETL files.

# Get all Users
$Users = Get-ChildItem -Path "$($ENV:SystemDrive)\Users"

# Process all the Users
$Users | ForEach-Object {
      Write-Host "Processing user: $($_.Name)" -ForegroundColor Cyan
      $path = "$($ENV:SystemDrive)\Users\$($_.Name)\AppData\Local\Temp\Outlook Logging\"

      If (Test-Path $path) {
        Write-host "Removing log files from $path" -ForegroundColor Cyan
        Remove-Item -Path $path -Recurse

        Write-host "Creating dummy file to prevent log files" -ForegroundColor Cyan
        New-Item -Path "$($ENV:SystemDrive)\Users\$($_.Name)\AppData\Local\Temp" -Name "Outlook Logging" -ItemType File
      }
}

To run the PowerShell script, copy it to PowerShell ISE or use one of the other options explained here to run PowerShell scripts.

Wrapping Up

Why Outlook keeps creating the ETL files is still unclear. Even setting the correct registry keys won’t prevent Outlook from creating the files. The problem with the ETL files started at the beginning of 2022. At the moment, there is still no permanent fix for this issue.

If you have any tips on this or questions, just drop a comment below.

5 thoughts on “How to Disable Outlook Logging and Remove the files”

  1. In addition to my previous comment.
    You may add the “/D” switch below for the CD command, if your %TEMP% folder is not on the same drive than your current drive.
    So the commands will become:

    CD /D %TEMP%
    mklink /D “Outlook Logging” nul:

  2. If you are local admin of your PC and if Outlook runs under your Windows user,
    simply type, in command line:

    CD %TEMP%
    mklink /D “Outlook Logging” nul:

    Indeed whatever the registry keys you will set, Outlook will still create huge ETL files, because Microsoft wants to log you and to slow down your PC anyway.
    But with the above commands, all these file creations will be sent to the NUL: device and the write attempts will simply fail.

  3. Cannot believe it’s 2024 and Outlook 2021 Pro Plus still creates this “Outlook Logging” folder, even with the feature toggled OFF (on several computers). And I have another folder that is being created with large files named “Diagnostics”. Kind of like a virus! I modified your PS script to include this “Diagnostics” folder and now both are getting zapped at system startup. Tried every other fix I could find with google without success. Good work!

  4. Just ran across this problem as my C drive was filling up. I deleted more than 20 GB of log files and implemented your fixes.
    Thanks!

Leave a Comment

0 Shares
Tweet
Pin
Share
Share