[transaction-logger] Fixed a bug in transaction logger

Since we are accessing db to deduce target id for a request, no use in
populating a dictionary by accessing db early. A try catch can be used