Reputation: 1
Currently I need to debug a market data subscription and I hope to obtain the blpapi logs to understand the transaction. Does anyone have an example to configure the logger and obtain blpapi logs during subscription?
I have looked up the Bloomberg api core developer guide and it only mentioned about setting blpapi log level to debug and a file directory to store all logs...
Upvotes: 0
Views: 212
Reputation: 4261
You can capture the logging messages within code, using a callback.
This is not very well documented (I had to look in the C++ header for the callback definition), but you can add this code, and register the callback (before you start the API Session):
import blpapi
def logCallback(threadId,severity,timeStamp,category,msg):
#Do what you want with the information ...
print(msg)
blpapi.Logger.registerCallback(logCallback,blpapi.Logger.SEVERITY_DEBUG)
If you first register the callback with SEVERITY_OFF you will get no messages. Then just before the code you want to debug you can call the function again with SEVERITY_DEBUG. In this way you will just get the messages for the actions you are interested in.
Upvotes: 1