hughhhh commented on a change in pull request #14057:
URL: https://github.com/apache/superset/pull/14057#discussion_r611875055
##########
File path: superset/utils/log.py
##########
@@ -118,12 +118,23 @@ def log_with_context( # pylint: disable=too-many-locals
duration_ms = int(duration.total_seconds() * 1000) if duration else
None
+ # Initial try and grab user_id via flask.g.user
try:
user_id = g.user.get_id()
except Exception as ex: # pylint: disable=broad-except
- logging.warning(ex)
user_id = None
+ # Whenever a user is not bounded to a session we
+ # need to add them back before logging to capture user_id
+ if user_id is None:
+ try:
+ session = current_app.appbuilder.get_session
+ session.add(g.user)
Review comment:
@etr2460 At this point in time the `g.user` is available the problem is
when we try and grab the `user_id`. Not sure boss why get_id() is cause the
unbounding session error.
I've been working on this for a week and this is working properly in adding
the user back to session and allowing us to query the user_id for logging.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]