Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Logging Class not working #217

Open
bouleq opened this issue Jun 21, 2021 · 1 comment
Open

Custom Logging Class not working #217

bouleq opened this issue Jun 21, 2021 · 1 comment

Comments

@bouleq
Copy link

bouleq commented Jun 21, 2021

Hi !
I am currently trying to use a custom EVENT_LOGGER in superset, i added the code snippets from the official doc but it isn't working:
I think the EVENT_LOGGER has changed and isn't the default DBEventLogger() anymore because we have some new logs on stdout, and there are no more "action logs" in the superset UI.
However, my JSONStdOutEventLogger() isn't used either, i added some prints in the log method to see if it was even called, and it doesn't seem so.
Here are the code snippets i added:

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')
          print("bip boup 1")
          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
              )
              print(json.dumps(log))
              print("bip boup 2")
configFile: |-
...
  from event_logger import JSONStdOutEventLogger
  EVENT_LOGGER = JSONStdOutEventLogger()

None of the "bip boup" prints are in the stdout, I hope i'm not missing something, thanks in advance for you help !

@amancevice
Copy link
Owner

You might have better luck filing this in the source repo: https://github.com/apache/superset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants