Jump to content

function for error logs.


nagalenoj

Recommended Posts

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

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 :P

 

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.