log transactions and use database