Log files

View: New views
7 Messages — Rating Filter:   Alert me  

Log files

by Mark Bomgardner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am writing an application in which I want to create log files.  I am
weighing the difference between using text files and using a database to
house the data.  It appears to me that there is really no advantage either
way or is there?  There are pros and cons to both methods, but I am
concerned about opening and closing a text file some many times that it may
cause and issue. The file may be opened and closed 1,000 or more times a
day.

 

Opinions please..

 

markb


Re: Log files

by Børge Holen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 02 July 2008 22:36:24 Mark Bomgardner wrote:

> I am writing an application in which I want to create log files.  I am
> weighing the difference between using text files and using a database to
> house the data.  It appears to me that there is really no advantage either
> way or is there?  There are pros and cons to both methods, but I am
> concerned about opening and closing a text file some many times that it may
> cause and issue. The file may be opened and closed 1,000 or more times a
> day.
>
>
>
> Opinions please..

for the ease of it, I would go for the database.
There is of course the details regarding the rest of the site to take into
consideration....
damn database is easy... <- take this one and go for files if not sustainable
enought.

>
>
>
> markb



--
---
Børge Holen
http://www.arivene.net

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Log files

by chris smith-9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark Bomgardner wrote:
> I am writing an application in which I want to create log files.  I am
> weighing the difference between using text files and using a database to
> house the data.  It appears to me that there is really no advantage either
> way or is there?  There are pros and cons to both methods, but I am
> concerned about opening and closing a text file some many times that it may
> cause and issue. The file may be opened and closed 1,000 or more times a
> day.

Opening/closing a file that number of times won't cause a problem, 1,000
 isn't a lot a day. If you needed to write something 1,000 times a
minute, you probably couldn't do that with a file without getting into
contention/locking issues.

What will you do with the logs once you have them?

Do you need to run reports based on the data in them?
Will you need to search for information in the logs?

If you need to run reports or search for info in the logs, I'd use a
database.

If you just need the logs for "Person A logged in at this time" type
messages then a file should be fine.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Log files

by Shawn McKenzie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark Bomgardner wrote:

> I am writing an application in which I want to create log files.  I am
> weighing the difference between using text files and using a database to
> house the data.  It appears to me that there is really no advantage either
> way or is there?  There are pros and cons to both methods, but I am
> concerned about opening and closing a text file some many times that it may
> cause and issue. The file may be opened and closed 1,000 or more times a
> day.
>
>  
>
> Opinions please..
>
>  
>
> markb
>
>

Using a database you're hitting a file the same number of times (the
database is in a file or files) but you have the mem/cpu overhead of the
db itself.  Having said that, if you are using a database already for
the site then might as well log to it.  I wouldn't implement a database
only for the purpose of logging.

-Shawn

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Re: Log files

by John Comerford-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you are logging errors, then maybe you should look at using a file
instead of a database table.  I have seen an instance where a system
used a table for error logging and writing to the log table caused and
error, you can guess where that left things.....

Shawn McKenzie wrote:

> Mark Bomgardner wrote:
>> I am writing an application in which I want to create log files.  I am
>> weighing the difference between using text files and using a database to
>> house the data.  It appears to me that there is really no advantage
>> either
>> way or is there?  There are pros and cons to both methods, but I am
>> concerned about opening and closing a text file some many times that
>> it may
>> cause and issue. The file may be opened and closed 1,000 or more times a
>> day.
>>
>>  
>>
>> Opinions please..
>>
>>  
>>
>> markb
>>
>>
>
> Using a database you're hitting a file the same number of times (the
> database is in a file or files) but you have the mem/cpu overhead of
> the db itself.  Having said that, if you are using a database already
> for the site then might as well log to it.  I wouldn't implement a
> database only for the purpose of logging.
>
> -Shawn
>


--
Option Systems Pty. Ltd.
53 Waverley Road, Malvern East, VIC 3145
PO Box 7, Caulfield East, VIC 3145
Phone: 03 9571 0100  Fax: 03 9571 0500
 
The information in this e-mail is confidential and is intended solely for the addressee.
Any views or opinions presented are solely those of the author
and do not necessarily represent those of Option Systems Pty.Ltd.
If you are not the intended recipient, please delete this message and
contact the sender.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: Re: Log files

by Haluk AKIN :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you are planning to come up with relations between these errors and other
activities on your website then you need to use a database.
If you will use this error log only for debugging purposes then a text file
should be enough.

From a coder's perspective the workload of coding both of these methods
should be similar.

Opening and closing a text file 1,000 or more times a day won't be a problem
either. Similarly, opening&closing that many database connections won't be
any problem either. Therefore, if I were you I wouldn't worry about the
performance.

Cheers,
Haluk



-----Original Message-----
From: John Comerford [mailto:johnc@...]
Sent: Thursday, July 03, 2008 12:54 AM
To: php-general@...
Subject: Re: [PHP] Re: Log files

If you are logging errors, then maybe you should look at using a file
instead of a database table.  I have seen an instance where a system
used a table for error logging and writing to the log table caused and
error, you can guess where that left things.....

Shawn McKenzie wrote:

> Mark Bomgardner wrote:
>> I am writing an application in which I want to create log files.  I am
>> weighing the difference between using text files and using a database to
>> house the data.  It appears to me that there is really no advantage
>> either
>> way or is there?  There are pros and cons to both methods, but I am
>> concerned about opening and closing a text file some many times that
>> it may
>> cause and issue. The file may be opened and closed 1,000 or more times a
>> day.
>>
>>  
>>
>> Opinions please..
>>
>>  
>>
>> markb
>>
>>
>
> Using a database you're hitting a file the same number of times (the
> database is in a file or files) but you have the mem/cpu overhead of
> the db itself.  Having said that, if you are using a database already
> for the site then might as well log to it.  I wouldn't implement a
> database only for the purpose of logging.
>
> -Shawn
>


--
Option Systems Pty. Ltd.
53 Waverley Road, Malvern East, VIC 3145
PO Box 7, Caulfield East, VIC 3145
Phone: 03 9571 0100  Fax: 03 9571 0500
 
The information in this e-mail is confidential and is intended solely for
the addressee.
Any views or opinions presented are solely those of the author
and do not necessarily represent those of Option Systems Pty.Ltd.
If you are not the intended recipient, please delete this message and
contact the sender.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Log files

by Per Jessen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark Bomgardner wrote:

> way or is there?  There are pros and cons to both methods, but I am
> concerned about opening and closing a text file some many times that
> it may cause and issue. The file may be opened and closed 1,000 or
> more times a day.

1000 times?  Nothing to worry about.  Even if you were talking about
100,000 times a day.



/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php