Title: Working with WP_DEBUG
Last modified: January 9, 2021

---

# Working with WP_DEBUG

 *  [Elba Mai](https://wordpress.org/support/users/mindtomatter/)
 * (@mindtomatter)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/working-with-wp_debug/)
 * Hi,
 * I’d like to look into the underlying code of WP_DEBUG. Where and how it’s called.
 * My aim is to see the feasibility of splitting debug.log files into smaller chunks
   such as 10MB and in a dir, both defined by the site admin.
 * Would anyone be able to point me in the right direction for the location of the
   code responsible for creating the debug.log file?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [5 years, 4 months ago](https://wordpress.org/support/topic/working-with-wp_debug/#post-13885826)
 * I’m not exactly sure, but start here: [https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-debug-data.php](https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-debug-data.php)
 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/working-with-wp_debug/#post-13885852)
 * That reference is simply the Site Health class that gathers debug data. It is
   not the long-existing mechanism of writing to the DEBUG log.
    Since the DEBUG
   options are PHP constants, it is much more difficult to treat them differently
   than they always have been. (you can’t change a constant)
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/working-with-wp_debug/#post-13886388)
 * The debug output is managed by the current PHP error handler. PHP provides a 
   default error handler, but you can replace it with your own. How and where the
   debug file is created, written, and managed is coded within PHP itself and can
   be controlled by configuration files like php.ini and httpd.conf. PHP code can
   in many cases override these settings, so exactly what happens is partly dependent
   on your particular server.
 * What WP_DEBUG does is override default error reporting and display settings in
   PHP. See
    [https://developer.wordpress.org/reference/functions/wp_debug_mode/](https://developer.wordpress.org/reference/functions/wp_debug_mode/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Working with WP_DEBUG’ is closed to new replies.

## Tags

 * [wp_debug](https://wordpress.org/support/topic-tag/wp_debug/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 4 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/working-with-wp_debug/#post-13886388)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
