Logs question...
#1

A simple question about logs (joins, parts, deaths and so on).

Is better to log them on MySQL or in a file?

Because i log everything in a file so im considering it to move in MySQL. How i can read a single log then?

Example: I have a join log, which logs PlayerName, IP and Date/time when joined, how i can read from a command ingame this log for the chosen player? Like /joinlog Face900, which will show all logs related to my name.
Reply
#2

Alright, I will reply your question before I sleep, to load files like .txt, etc... you need to use fopen - to open the file, fwrite - to something write in a file, fclose - to close a file,fread - to read a file,fexist - to check if the file exist or not and fremove - to delete a file.

Useful Link:

https://sampwiki.blast.hk/wiki/Fwrite
https://sampwiki.blast.hk/wiki/Fopen
https://sampwiki.blast.hk/wiki/Fclose
https://sampwiki.blast.hk/wiki/Fremove
https://sampwiki.blast.hk/wiki/Fread
Reply
#3

Emh, i already open the files with fopen and so on. I just need to know how to read a specific log if i store it in a mysql table.
Reply
#4

Storing logs in MySQL is not very useful. Just store it in a file.
Reply
#5

Quote:
Originally Posted by Seif-
Посмотреть сообщение
Storing logs in MySQL is not very useful. Just store it in a file.
Why not? i do it. It just depends what you need the "logs" for. Its useful if you want to display the logs in game, as well as on your website. If its in game, a simple file system will do.
Reply
#6

Who says you can't upload info from files into a database? :P I don't know how but I will find out how! :P
Reply
#7

Quote:
Originally Posted by Seif-
Посмотреть сообщение
Storing logs in MySQL is not very useful. Just store it in a file.
Why not? Storing logs in MySQL makes it easier to for example put the logs on a web based ACP.

(Note: Can still be done with regular text files, but in my opinion it is easier to use a combination of PHP and MySQL)
Reply
#8

Still nobody has answered my queston, lol

Quote:

Example: I have a join log, which logs PlayerName, IP and Date/time when joined, how i can read from a command ingame this log for the chosen player? Like /joinlog Face900, which will show all logs related to my name.

^ In case i store in MySQL.
Reply
#9

Quote:
Originally Posted by Face9000
Посмотреть сообщение
Still nobody has answered my queston, lol



^ In case i store in MySQL.
It depends on your table structure.

You should store it in a file only if you don't need to actually read the log file.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)