Using Preferences library for logging

Everything else that doesn't fall into one of the other PB categories.
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Using Preferences library for logging

Post by es_91 »

Hey.

I would like to ask you if you have experience in using the Preference library for creating and expanding log files.

This could work like that: Important messages are created as Preference groups (to really create the group in the file you'd have to write a key into it and remove the key again). Parameters or lesser important information can then be written in group keys.

My question is to the speed of this library. We're not talking about high speed applications here, but imagine you'd have to write a server software that logs new connections and all messages sent and received.

Also: would it be better to keep the file opened during complete runtime or is it of no matter to always open and close them when writing down a client information structure? (Two possible scenarios: writing down every message immediately OR writing all messages and connection times of a specific client after it disconnects.)

What do you think? Ever measured the time it takes to open/close a preference file? (Maybe in a larger project?)
:mrgreen:
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Using Preferences library for logging

Post by RSBasic »

If many times the file is opened and closed then it's a bad performance.
You can wait until the protocol variable has a minimum length. Then you can save the content once.
Image
Image
Post Reply