-1

hi im thinking about user activity in laravel application .. and i thought is it better to keep user activity in saparated log file than keep it in database .. like create folder in storage folder for every user .. and create log file with date like this ..

user_id_YYY-mm-dd.log

is that better thank keep logs in database

softya
  • 229
  • 7
  • 22

2 Answers2

0

Definitely store it in the database.

If you're looking to log activity, you'll end up with a large number of records and want these indexed. A few users using a piece of software for a few months can quickly generate thousands of records, depending on how detailed your tracking is.

Storing activity logs in text files will be okay in the beginning, but as soon as you want to find all actions of type X by user Y, you'll be spending hours searching through text files (or writing scripts to do it for you).

Joundill
  • 6,828
  • 12
  • 36
  • 50
0

Logs on Laravel works really well to debug, but to get an history from user activity save data in database always is the best option.

You can create a log table and indexing with user_id and create reports from user activity.

querying by date, action or any other field.