So my problem is that my xdebug.log file is too big and so I was thinking of splitting it by one file a day. I know how to do that manually, but I'd like to know if it was possible to set a dynamic path to a new xdebug file through php.ini as it is where the path is defined. currently I have this:
php.ini
xdebug.remote_log="D:\Work\Project\www\xdebug.log"
and I'd like to end up with something like this:
php.ini
xdebug.remote_log="D:\Work\Project\www\2017\02\23_xdebug.log"
I do know that there is a possibility to use some variable (I did read the php doc, google after it for severals hours) but I can't really find a clear answer so far about if I can do this, have a workaround or just how to do it!
Thanks in advance!! (if I missed some information to provide just tell me!)
Just simply went through this with the script solution in the end, using powershell.
Here you can see the function (you can directly add it in your Microsoft.Powershell_profile.ps1 (more info about how to create one here : https://www.howtogeek.com/50236/customizing-your-powershell-profile/)
function xdebugsetlogpath {
# Set directory logs path (year\month)
$DirPath = ("Path\To\Your\logs\" + (Get-Date -UFormat '%Y\%m'))
# Set xdebug.log file name (day_xdebug.log)
$NewFile = (Get-Date -UFormat '%d') + "_xdebug.log"
# Set full file path
$NewFilePath = ($DirPath + "\" + $NewFile)
# Create the folder beforehand as xdebug wont do it itself
New-Item -ItemType Directory -Force -Path $DirPath
# Create the file (xdebug can do it but well)
New-Item $NewFilePath
(Get-Content C:\PHP712\php.ini) | `
ForEach-Object { $_ -replace 'xdebug.remote_log=.*',('xdebug.remote_log="' + $NewFilePath + '"') } | `
Set-Content C:\PHP712\php.ini
# Don't forget to restart service
httpd -k restart
}
After adding it to your profile, simply restart your powershell prompt and type xdebugsetlogpath
and that it! (don't forget to edit the path where you want to get your logs in!)