The invention provides a method for recording a transaction log, which includes the following steps: the database changes from a connected state to an interrupted state, and performs a dump operation, that is, serializes the data in the memory to obtain a text data stream, and converts the text data The stream is recorded on the transaction log. At this time, the storage mode is converted from the database storage mode to the transaction log storage mode; the database is in an interrupted state. At this time, the storage mode adopts the transaction log storage mode, and the storage operation only interacts with the transaction log; the database is controlled by The interrupted state changes to the connected state, and the submit operation is performed, that is, the data in the memory is submitted to the database. At this time, the storage mode is converted from the transaction log storage mode to the database storage mode; the database is in the connected state. At this time, the storage mode adopts In the database storage mode, the storage operation only interacts with the database and deletes the corresponding local transaction log. The method has the advantages of being simple, fast and convenient to use.