bouleq commented on issue #15548:
URL: https://github.com/apache/superset/issues/15548#issuecomment-1076162327


   Hello, yes we managed to fix it. It turned out that logs were not written at 
the right place by the logging class. We added this to the code :
   ```
   with open("/var/lib/superset/action.log","w") as f:
                   f.write("\n [LOG]: " + json.dumps(log) + "\n") 
   ```
   
   The full code snippet is now: 
   
   ```
   event_logger.py: |-
       from superset.utils.log import AbstractEventLogger
       import json
       class JSONStdOutEventLogger(AbstractEventLogger):
         def log(self, user_id, action, *args, **kwargs):
             records = kwargs.get('records', list())
             dashboard_id = kwargs.get('dashboard_id')
             slice_id = kwargs.get('slice_id')
             duration_ms = kwargs.get('duration_ms')
             referrer = kwargs.get('referrer')
             for record in records:
                 log = dict(
                     action=action,
                     json=record,
                     dashboard_id=dashboard_id,
                     slice_id=slice_id,
                     duration_ms=duration_ms,
                     referrer=referrer,
                     user_id=user_id
                 )
                 with open("/var/lib/superset/action.log","w") as f:
                   f.write("\n [LOG]: " + json.dumps(log) + "\n")
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to