Hi Everyone
I want every single operation carried out on my application from signing in to signing out written to a text file and the operations would have a timestamp for each corresponding operation. How do i go about this, i have no single idea at all.


You need to write log for each event or each execution step if required .

1st of all, you do realize that a text file can be edited by hand and offers next to no security, right? (If the user running the program doesn't have access to the file, then neither will the program).
We use text files for logs only for debugging or tracing. Not for security and login and logout events sound security to me. (ie: I login, delete everything, logout and edit the file to remove all records that have something to do with me).

Why not use a password protected database instead? If you allow more than 1 instance of your program this will also save you the hasle of being locked out of your log file.

adam k, logs can be used for event tracking in general from login to sign out. There wont be any breach in secuirty because the aplication wont pas out account information to the text file(sql server keeps its logs just incase you're not aware).......better thinking right?

Debasisdas, thanks alot. I already did that but i have a table in the database where i do sale the logs, was just thinking there would be a better or easier way rather than writting for all events.

Thanks guys

I know this thread is marked as solved buy I think the following is still of interest.

Windows maintains several event logs (Application, Security, etc). You can use the Windows event subsystem to create and maintain a custom log which is viewable through the event viewer management console plugin (eventvwr.msc). Information on how to create the log is available at