How can I set up error_log by folder

Camilo Lizarazo picture Camilo Lizarazo · May 8, 2012 · Viewed 7.4k times · Source

My company has a large hosting but its not managed by us, we don't see config files but I want to reply this feature on our local test server.

Im new in my company and want to start some debug of applications to fix some minors and majors issues to clients but amount of files is so big that single error_file is huge.. and there are many people working on this so each time I check log (like 30 secs to 1 min) has hundreds of added lines.

I dont know if this is setup on apache, through .htaccess files or on php.ini.

-- EDIT --

I am talking about PHP errors, But how I say I don't know if this is set on php or apache or maybe using third party library.

I'm not talking about setting a specific folder error_log, I'm talking errors are logged on scripts folder.

Example: I create a folder named test1, inside I make some buggy php script that throw some errors, when I run script I can see a error_log file created on the folder. So it works on the fly.

I have tried to ask hosting company support how they do this but, they havent answer me.


I don't know if maybe could be some kind of Cpanel setting (BTW Hosting Support stuff doesn't understand either this question but well.. usually Level 1 of support cant handle technical stuff)

Answer

Camilo Lizarazo picture Camilo Lizarazo · May 23, 2012

I found it.

You have to set on php.ini file directive as follow,string "error_log" on right side is the file name you want for log,

error_log = error_log

This will generate a php error log on folder where script executed are,

I'll try to explain

script test.php in folder /www/site/lib

include "./db_conn.php";

If db_conn.php its not located on same directory, this will fire a warning and error, usually this will be lead to serves/vhost log, but using this directive you will get an error_log file under /www/site/lib directory.

Why I was looking or this, well as I wrote I wrote I'm working on a huge app, with thousands of files many fires warnings, notices, etc. I'm not the only one in project and site error_log was so huge was hard to keep tracking debug evolution for one or just some files, now I just have to track the log from dirs where I'm working.