---
schema_version: "1"
id: 123a4aa3cf24db59bf1f40bae00709d4855a5fdd47da37f7f24e64536876614f
title: Debugging Apex
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_debugging.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_debugging.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: e1e63faa815f1464a52ee8196c9811f65792f159f9b86ada6c3ca529712b8f79
description: Apex provides debugging support. You can debug your Apex code using the Developer Console and debug logs.
---
# Debugging Apex

Apex provides debugging support. You can debug your Apex code using the Developer Console and debug logs.

To aid debugging in your code, Apex supports exception statements and custom exceptions. Also, Apex sends emails to developers for unhandled exceptions.

1. [Debug Log](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_debugging_debug_log.htm)
2. [Exceptions in Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_exception_definition.htm)  
    Exceptions note errors and other events that disrupt the normal flow of code execution. throw statements are used to generate exceptions, while try, catch, and finally statements are used to gracefully recover from exceptions.