First, logging is a crosscutting functionality and to accommodate end-to-end functionality in the code model (afterSave) never true. It is better to make a separate
behavior which will cling on
event save the model and enter the required data in the database.
Secondly, why do You use model the log when logging? You in essence just need to generate the data and write them to the database and everything. There is no point in spending resource in the model is not using the functionality, so it is best to enter direct queries to the database.