Finally got some time to try something, after my previous poor attempt at creating a log file :-) So, I shouldn't an array, but the file has got to be read somehow, so I'm assuming I should use file_get_contents() ?
<?php // Random test errors $error = array('Double Hit', 'Preset Post', 'No Session', 'Spam Detected', 'Profanity Found'); $fault = $error[array_rand($error)]; $logfile = 'reject.log'; $record = date('d-m-Y H:i:s')." [$fault]\n"; error_log($record, 3, $logfile); // Small file sizes just for testing if (filesize($logfile) > 1000) { $logdata = file_get_contents($logfile); $nline = strpos($logdata, "\n", 500); $newdata = substr($logdata, $nline); $fp = fopen($logfile, 'w'); stream_set_write_buffer($fp, 0); fwrite($fp, $newdata); fclose($fp); } // Readfile just for test echo '<pre>'; readfile($logfile); echo '</pre>'; ?> Have used stream_set_write_buffer($fp, 0) for the first time. Is it needed? I've tried flock() before and it seemed to screw things up. Clicking the refresh button repeatedly shows it works, but is it any good, or should I start again? Thanks, Bob E. ------------------------------------ Please remember to write your response BELOW the previous text. Community email addresses: Post message: php-list@yahoogroups.com Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-listYahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/php-list/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/