Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My disk space usage is increasing very fast because of the logs. Everyday I get ~1.5 GB log file. How can I disable that?

share|improve this question

migrated from stackoverflow.com Mar 20 '11 at 8:48

This question came from our site for professional and enthusiast programmers.

1  
What is being logged that's taking up all that space? Is something logging full debugging info when it should only be logging errors? Is something failing horribly and trying to get your attention? –  David Mar 19 '11 at 12:27
2  
Assuming you are talking about the error log, how about fixing the errors instead of pretending they are not there? –  Gordon Mar 19 '11 at 12:31
    
Please clarify "the logs". Which logs? Apache Logs? Access Logs? Error Logs? PHP logs? –  Gordon Mar 19 '11 at 13:17
add comment

4 Answers 4

up vote 3 down vote accepted

Disabling logs is never a good idea. You can use programs like logrotate to rotate your log files if the space is the issue. If you insist on not keeping log files. Please direct your program's log directive to /dev/null

share|improve this answer
add comment

firstly try to minimize errors then if that fails

 ini_set ('log_errors',false);
share|improve this answer
    
@Lawrence Cherone: I should add this line in header.php? –  hey Mar 19 '11 at 12:29
    
anywhere before the errors can occurs, fix errors first tho, debugging is half the fun of php :/ –  Lawrence Cherone Mar 19 '11 at 12:31
    
info regarding error logging can be found here php.net/manual/en/errorfunc.configuration.php –  Lawrence Cherone Mar 19 '11 at 12:35
add comment

PHP Logs can become an annoyance when you're stuck in an environment you don't own, you're writing a CLI script real quick, and the log output insists on going right to the command line. It would be nice if there were a quick answer like:

ini_set('error_log', '/dev/null');

Oh wait, that does work.

share|improve this answer
add comment

Since this is probably not about PHP, check out the Apache settings http://httpd.apache.org/docs/2.0/mod/core.html#loglevel

LogLevel error

Will hide warnings, and debug messages. Can be set per vhost. The next higher level would be crit, but is inadvisable.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.