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

ST2 logs writing "(unknown file)" in log prefix, instead of module name #5057

Closed
punkrokk opened this issue Oct 14, 2020 · 1 comment · Fixed by #5058
Closed

ST2 logs writing "(unknown file)" in log prefix, instead of module name #5057

punkrokk opened this issue Oct 14, 2020 · 1 comment · Fixed by #5058
Assignees
Milestone

Comments

@punkrokk
Copy link
Member

punkrokk commented Oct 14, 2020

SUMMARY

In ST2 v3.2, the st2sensorcontainer.log, and in v3.3 all st2 logs have the module name replaced with (unknown file)

STACKSTORM VERSION

v3.2, v3.3, EL8 and U18.04
Python 3.6

OS, environment, install method

One Line and Ansible so far.

Steps to reproduce the problem

Show how to reproduce the problem, using a minimal test-case. Make sure to include any content
(pack content - workflows, actions, etc.) which are needed to reproduce the problem.

Expected Results

No (unknown file), but the python module name.

Actual Results

2020-10-13 17:55:13,787 140460262501416 INFO (unknown file) [-] Sensor linux.FileWatchSensor started
2020-10-13 17:55:15,444 139725927337456 INFO (unknown file) [-] No config found for sensor "FileWatchSensor"
2020-10-13 17:55:15,446 139725927337456 INFO (unknown file) [-] Watcher started
2020-10-13 17:55:15,446 139725927337456 INFO (unknown file) [-] Running sensor initialization code
2020-10-13 17:55:15,454 139725927337456 INFO (unknown file) [-] Running sensor in passive mode
@punkrokk punkrokk added this to the 3.3.0 milestone Oct 14, 2020
@punkrokk punkrokk changed the title ST2 logs writing "(unknown file)" in log prefix ST2 logs writing "(unknown file)" in log prefix, instead of module name Oct 14, 2020
@nmaludy
Copy link
Member

nmaludy commented Oct 14, 2020

This is python 3 only. The logging module determines this information using a logging.findCaller() function.

Python 2.7 version: https://docs.python.org/2/library/logging.html#logging.Logger.findCaller
Python 3.6 version: https://docs.python.org/3.6/library/logging.html#logging.Logger.findCaller

StackStorm overrides this function here: https://github.com/StackStorm/st2/blob/master/st2common/st2common/log.py#L131
Our implementation is here: https://github.com/StackStorm/st2/blob/master/st2common/st2common/log.py#L72-L95

This function has the signature for the 2.7 python version and returns a 3-element tuple as python 2 expects. However, in Python 3 a new argument is specified called stack_info and the returned value from logging.findCaller() is expected to be a 4-element tuple. This 4th element is stack information derived from the stack_info value passed in.

We currently do not handle these cases and are returning an incorrectly sized tuple from the function in python 3.

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

Successfully merging a pull request may close this issue.

2 participants