You should debug code only in the **Integration** environment. You should debug in the Preproduction/Production environments only when absolutely necessary. Contact Optimizely to submit a support ticket for remote debugging.
## Check service status
Visit the [Microsoft Azure Status dashboard](🔗) for general service operation information. See the [Optimizely service dashboard](🔗) for Optimizely-specific operational status.
## Access Azure Portal
Contact Optimizely to [get access to your DXP-specific resources](🔗) in the Azure portal, so that you can monitor and troubleshoot your solutions. When logged in, the Azure portal will display information as in the example below.
## Enable debugging
You need to enable debugging in both the Azure Portal and Visual Studio. You first allow remote debugging in the Azure portal, and then attach to the correct process in Visual Studio.
See [Microsoft’s Remote Debugger Port Assignments](🔗) to ensure your remote debugger’s IP address is connected.
In the Azure portal, select **App Services**.
Select an Integration environment from the **App Services** list.
Select **Settings > Configuration**.
Open the **General settings** tab and go to the **Debugging**section. a. Set **Remote debugging** to **On**. b. Set **Remote Visual Studio version** to the version being used.
In Visual Studio, select **View > Cloud Explorer**.
Click the person icon to display your subscriptions.
Select your subscription and click **Apply**.
Select _subscription_ > **App Services** > and right-click on the Integration environment (a subscription with an _inte_ suffix) and select **Attach Debugger**.
If a connection error occurs with the URL of the site being loaded, go back to the Azure portal, select **Settings > Custom domains** to obtain the IP address that is used by the URL. Add this IP address and the URL from the error message to the _hosts_ file on the machine (located at _C:\\Windows\\System32\\drivers\\etc\\hosts_). For example:
If you get an error message - ”Unable to connect to the Microsoft Visual Studio Remote Debugger” - fix this with the following procedure:
Get the development machine's public IP.
In the Azure portal, go to **AppService > Networking > Access restrictions**.
Place the public IP on the allow list.
Then repeat step 8.
## Activate logging
Optimizely supports writing to the diagnostics log using BLOB storage. See [Logging into .Net Diagnostics Trace](🔗) for more details on how this works.
To activate the logging:
Select **App Services** for the Integration environment, and go to **Diagnostics log.**
Set the **Application Logging (Blob)** to _On_, select desired **Level** of verbosity, and select a storage account and container under **Storage Settings.**
Click **Save** when done.
The Web App will restart when activating the logging.
## Log information and Kudu services
Access the website log files in the integration environment using any of the methods described in this section.
### Download log files
Use the download/FTP options available in Azure Portal under **Diagnostics logs** for the environment.
### Kudu services tool
Azure websites have an associated "scm" service site, where you can run site extension tools. For DXP, the [Kudu services tool](🔗) is available with your access to the Azure Portal.
To access the service tool, you add an "scm" segment to the environment site URL, for example _<https://epvscms3p60ginte.**scm**.azurewebsites.net/>_
The service tool lets you access files for the site, and display information in Optimizely logs available under _site/wwwroot/appdata_ and _logfiles/eventlog_.
## Enable detailed error messages
You might find it useful to [turn on detailed ASP.NET error messages](🔗) in _web.config_ for your solution in the Integration environment, as an additional tool when debugging.