Skip to content

Logging API Breaks in Python 3.8 #4922

@Dahfizz9897

Description

@Dahfizz9897

SUMMARY

The Python logging module added an optional argument to the findCaller function, which breaks the way that we overwrite the functoin. Similar to this: https://twistedmatrix.com/trac/ticket/9668

STACKSTORM VERSION

st2 3.2dev, on Python 3.8.2

OS, environment, install method

Installed from source on Ubuntu 20.04

Steps to reproduce the problem

Install st2 from source on ubuntu 20.04, which has python 3.8, and run ./tools/launchdev.sh start

Expected Results

st2 starts

Actual Results

Traceback (most recent call last):
  File "./st2common/bin/st2-register-content", line 22, in <module>
    sys.exit(content_loader.main(sys.argv[1:]))
  File "/root/st2/st2common/st2common/content/bootstrap.py", line 406, in main
    setup(argv)
  File "/root/st2/st2common/st2common/content/bootstrap.py", line 397, in setup
    common_setup(config=config, setup_db=True, register_mq_exchanges=True,
  File "/root/st2/st2common/st2common/script_setup.py", line 96, in setup
    db_setup()
  File "/root/st2/st2common/st2common/database_setup.py", line 56, in db_setup
    connection = db_init.db_setup_with_retry(**db_cfg)
  File "/root/st2/st2common/st2common/persistence/db_init.py", line 68, in db_setup_with_retry
    return db_func_with_retry(db_setup, db_name, db_host, db_port,
  File "/root/st2/st2common/st2common/persistence/db_init.py", line 58, in db_func_with_retry
    return retrying_obj.call(db_func, *args, **kwargs)
  File "/root/st2/virtualenv/lib/python3.8/site-packages/retrying.py", line 206, in call
    return attempt.get(self._wrap_exception)
  File "/root/st2/virtualenv/lib/python3.8/site-packages/retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "/root/st2/virtualenv/lib/python3.8/site-packages/six.py", line 696, in reraise
    raise value
  File "/root/st2/virtualenv/lib/python3.8/site-packages/retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "/root/st2/st2common/st2common/models/db/__init__.py", line 164, in db_setup
    connection = _db_connect(db_name, db_host, db_port, username=username,
  File "/root/st2/st2common/st2common/models/db/__init__.py", line 119, in _db_connect
    LOG.info('Connecting to database "%s" @ "%s" as user "%s".' % (db_name, host_string,
  File "/root/st2/st2common/st2common/log.py", line 115, in func_wrapper
    raise e
  File "/root/st2/st2common/st2common/log.py", line 105, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.8/logging/__init__.py", line 1434, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python3.8/logging/__init__.py", line 1565, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
TypeError: find_caller() takes from 0 to 1 positional arguments but 2 were given```

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions