Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#38735 closed enhancement (duplicate)

Custom PATH for debug.log

Reported by: mesaquesoares's profile mesaquesoares Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6.1
Component: General Keywords:
Focuses: administration Cc:

Description

Hi!!
I am a DevOps, and i like to put every services log on one place, for organization, fast debug and security.

Sow i propose a php constant that define the debug.log place.

in line 331 of wp-includes/load.php we have this:

<?php
ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );

if we add this after this block:

<?php

if( defined('WP_DEBUG_DIR') ) {
   ini_set( 'error_log', WP_DEBUG_DIR . '/debug.log' );
}

full block

<?php
ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
if( defined('WP_DEBUG_DIR') ) {
   ini_set( 'error_log', WP_DEBUG_DIR . '/debug.log' );
}

and after if we defined this constant WP_DEBUG_DIR on wp-config.php we can successfull set a custom debug.log place

Thx have a nice day

Change History (9)

#1 follow-up: @danielbachhuber
8 years ago

Have you considered symlinking WP_CONTENT_DIR . '/debug.log' to an alternate path?

#2 in reply to: ↑ 1 @mesaquesoares
8 years ago

Replying to danielbachhuber:

Have you considered symlinking WP_CONTENT_DIR . '/debug.log' to an alternate path?

Actually i have thinked about that before write this post but it is not the same... i have managed a lot of wordpress instalations and it is only a fell have cared about have take a security measured for dont have debug.log published over the internet..

i think over 40% of debug.log can be download over the internet :( just typing domain.com/wp-content/debug.log

#3 @mesaquesoares
8 years ago

try search this on google.com

inurl:wp-content/debug.log

#4 @westonruter
8 years ago

  • Component changed from Customize to General

#5 follow-up: @lukecavanagh
8 years ago

@mesaquesoares

Why not just define it in a must-use plugin instead?

ini_set( 'error_log', '/srv/www/all-debug.log' );

Reference. https://deliciousbrains.com/why-use-wp-debug-log-wordpress-development/

#6 in reply to: ↑ 5 @mesaquesoares
8 years ago

Replying to lukecavanagh:

@mesaquesoares

Why not just define it in a must-use plugin instead?

ini_set( 'error_log', '/srv/www/all-debug.log' );

Reference. https://deliciousbrains.com/why-use-wp-debug-log-wordpress-development/

Plz no, one more plugin just for that? actually we have a tons of plugin on ours wordpress installations ... i have managed installations with 60 or 70 plugins activated it is like dress of retails...

i think the PHP constant will cost less and more secure than a plugin that any novice can disable on our administration panel

#7 follow-up: @lukecavanagh
8 years ago

@mesaquesoares

One simple must-use plugin in the mu-plugins folder inside of wp-content, is really not that big a deal.

#8 in reply to: ↑ 7 @mesaquesoares
8 years ago

Replying to lukecavanagh:

@mesaquesoares

One simple must-use plugin in the mu-plugins folder inside of wp-content, is really not that big a deal.

in my experience actually most of the users don't care about of what is write on wp-config.php, but they care and manage the plugins and eventually they go to them for disable some of the ones they dont know about releasing the debug.log over the internet again...

because of that o think will be much, much more simple going to every wordpress i have managing and write this constant on wp-config.php and i will know for sure they will not there customize or remove the constant.

#9 @dd32
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Adding a constant to define the location of the debug file seems a little overkill to me here, although adding some functionality (such as setting WP_DEBUG_LOG to a string to allow defining the path, see #18391)

The two obvious choices to me right now would be:
a) Instead of using WP_DEBUG_LOG in the wp-config.php file, set log_errors and error_log to the location you wish to have them logged.
b) use a auto_prepend_file at the PHP level and force WP_DEBUG_LOG off (if you can't trust your WordPress installs to have that constant disabled/not set), and setting the PHP ini settings to where you want them.

I'm marking this as a duplicate of #18391 though due to the functionality request being the same.

Note: See TracTickets for help on using tickets.