nagalenoj Posted December 11, 2008 Share Posted December 11, 2008 Dear friends, I want to log the error messages in a file. Now, I am managing with a simple write in a file. But, I have to rotate the files, if the file size is exceeded. For example, If the size of log.txt is exceeded, log.txt.1 has to be created and the old logs have to be in the log.txt.1 and log.txt has the recent logs. can anyone know any function to do this In perl, we have some packages like log::rotate. Link to comment https://forums.phpfreaks.com/topic/136483-function-for-error-logs/ Share on other sites More sharing options...
redarrow Posted December 11, 2008 Share Posted December 11, 2008 Why not just use mysql a free database. It pointless having million files in a year........ Link to comment https://forums.phpfreaks.com/topic/136483-function-for-error-logs/#findComment-712402 Share on other sites More sharing options...
Mchl Posted December 11, 2008 Share Posted December 11, 2008 Why not just use mysql a free database. It pointless having million files in a year........ Because you might need to log, that you can't connect to database Usually I save my logs like this $logHandle = fopen("log".date("Ymd").".txt","wb"); //this will create a file named log20081211.txt today, and log20081212.txt tomorrow So I have one logfile for each day. Would that satisfy you? Link to comment https://forums.phpfreaks.com/topic/136483-function-for-error-logs/#findComment-712418 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.