简体   繁体   中英

Trace source file of an error_log php

I often use error_log to output information when I am developing stuff so I can see the content of arrays and such- I am not sure if this is a good way of doing things but I am self taught so forgive me!

Anyway, somewhere I must have forgotten to comment an error_log out because I am continuously getting an error_log message of 'post_type=' and for the life of me I just cannot track it down, I have done a search for 'post_type=' in all of my files and also been through every error_log I can find and checked that it is commented out but just cannot track this darn thing down...

SO what I was wondering is if anyone knows how I can trace the source of the last error_logged message so I can find the file that is sending it. I tried error_get_last() but this isn't returning anything I think because its not actually an error that is getting logged but a message I am outputting manually...

Failing that, I see that in Dreamweaver there is a way to search using regular expressions and was just wondering if anyone knows how I can make it search for error_log that not preceded by '//'

Thanks in advance :)

You can change your error log file permissions to nothing, so only "root" user has access to it. Then navigate on your website, and hopefully at some point you'll trigger that error, and as Apache won't have the rights to write in this file, php will trigger an error, giving you the opportunity to know from where it comes.

Also, if you are willing to see the content of a variable, you can use var_dump($myVar) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM