Database logging and transactions

I am using MySQL with transactions and I have a table that I log some data to. I want the data that I write to this table to be immune from rollbacks and failed transactions. The best approach I have found is to create a second database component (the same database). Now if I start a transaction on Yii->$app->db I can safely perform a database write using Yii::$app->dbalt. Regardless of how the transaction ends, the data written using Yii::$app->dbalt is saved.

Is this the best approach, or am I missing something?