Skip to content

ENH: show file/line in facility log message#346

Merged
klauer merged 5 commits into
pcdshub:masterfrom
klauer:enh_better_global_exceptions
Jul 14, 2022
Merged

ENH: show file/line in facility log message#346
klauer merged 5 commits into
pcdshub:masterfrom
klauer:enh_better_global_exceptions

Conversation

@klauer
Copy link
Copy Markdown
Contributor

@klauer klauer commented Jul 13, 2022

Description

Show source of exception in facility log message summary, such as:

(from user input)

2022-07-13 15:44:44	
  In [2]: abc()
  Exception: ValueError: this is the exception message
  File: /cds/home/k/klauer/Repos/hutch-python/raiser.py line 9

(from a thread - showing the closest input number)

	
2022-07-13 15:44:44	
  Thread: Thread-51
  Last user input [2]: abc()
  Exception: RuntimeError: this is the exception message
  File: /cds/home/k/klauer/Repos/hutch-python/raiser.py line 5

Motivation and Context

The current message is insufficient to get an idea of what happened (from Grafana):

2022-07-13 12:40:28	
  Line: 31
  Input: tmo_laser.lens_z.limits()
  Exception: TypeError: 'NoneType' object is not callable

pcdsutils will need an update to include this information in the JSON sent to logstash as well.
Related PR (not required for this PR): pcdshub/pcdsutils#65

How Has This Been Tested?

Locally, so far

Where Has This Been Documented?

PR text

@klauer klauer requested review from ZLLentz and tangkong July 13, 2022 22:16
Copy link
Copy Markdown
Contributor

@tangkong tangkong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Simple and clean, adding some very much needed information for debugging.

Copy link
Copy Markdown
Member

@ZLLentz ZLLentz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me too, good extra info for the facility logger

@klauer klauer merged commit a770f9d into pcdshub:master Jul 14, 2022
@klauer klauer deleted the enh_better_global_exceptions branch July 14, 2022 17:47
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

Successfully merging this pull request may close these issues.

3 participants