Howdy, I am shipping my logs to LogzIO
Only logging from Server Module’s get shipped. The configuration is stored in a dictionary in a shared module.
Then in my server modules I include lines like this
from ServerShared import LOGGING
logging.config.dictConfig(LOGGING)
root = logging.getLogger()
logger = root
You’ll need to be mindful of flushing the buffer here is a gist I wrote on the topic FYI, I put in a request for the LogzIO team to build an annotation into their code base and it seems they did so in version 2.0.15, but I haven’t started using it.
The gist also shows the dictionary that is stored in the LOGGING
variable from the shared server.
I picked LogzIO, because I saw logzio-python-handler in the installed packages list. It seemed to be shortest path to getting something up and running. (I.e. fewer requests to the Anvil team to install python packages, etc)
One Tip, if you use the multiple Anvil apps for DEV / PROD flows, make sure you put the Anvil App Id in your formatter e.g.
'logzioFormat': {
'format': '{"additional_field": "value", "ANVIL_APP_ID": "%s"}' % str(anvil.app.id)
}
Then you can filter by App on LogzIO side for development or production version of the app.
Hope this helps.
Cheers,
Tyler