I've got an obeserver that is run inside a transaction. It's writing log data to database. My problem is that these log entries are missing if the transaction aborted. Is there any way to have $model->save() ignore a surrounding transaction? Is it possible to have a model use a second connection to the main Magento database without duplicating configuration?

1 Answer 1


I wouldn't log into database, but if you have to:

The most simple option would be make a background job for writing logs into database:

  1. Create a new cache entry with your log with specific cache tag
  2. Create a cron jobs that finds all cache entries by this tag and writes them to database, then deletes them

Or simply use a standard logging mechanism, with file appending. Then parse log file into database table for searching.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.