Hellow everyone in the community. I’ve been having problem about logs. honestly i don’t know how to use them and even if i read the documentation on logs i barely even understand. also video tutorials is hard to follow and understand. I’m new to using logs so i don’t really know how to use them very well.
I want to get logs for the user data in database. add, edit, delete… the details i need are those information inputted on the table. making them display in the log. ex: test added, test renamed to welcome, welcome has been deleted.
I’m very sorry for the trouble. I’m a student and still learning about this things. I would be so glad if someone can point me to the right direction on how to start. Thank you so much for responding to my post.
The next thing you need to learn is the fact, that you can hook into the ORM via event methods as you can see here: Table Objects - 4.x
You can do this on a per table basis or you can hook into the global event manager and listen for all e.g. Model.afterSave and Model.afterDelete events.
Inside e.g. the Model.afterSave you have access to the $entity->isNew() method which tells you if the entity already existed or was just created (aka update vs insert)
And the combination of all of these things will let you implement a log file which tells you what you need
thank you for commenting to my post. i appreciate your help kind sir. I will do your recommendations and learn more about it in the documentation you provided. Thank you so much.
hellow good sir. It looks like im having problem with the datasource in the plugin you’ve suggested.i’ve done the necessary steps in installing the plugin, the audit stash plugin and elastic search on the composer, put the elastic configuration on the app.php. im running my server based on bin\cake server on cakephp and i just putted it on 127.0.0.1 since that ip if im not mistaken is for loop back. I’ve done mostly up to using audit stash in the plugin document. but now it shows that error. have you sir perhaps encountered this problem and solved it? i would really be glad to hear for your guidance on this matter. Thank you so much