无法匹配金字塔生成的线程 tid 和 tid。

unable to match thread tid and tid generated by pyramid.

导入线程

def worker():

    """thread worker function"""

    print threading.currentThread().ident

    return

我=0

当我<5:

    t.start()

    i=i+1

输出:

1972960112

1989745520

1998134128

1939389296

1981356912

但是,金字塔日志给出了一组单独的 tid.. 有点像...

1807137648

1763703664

1780480880

1832303472

1797258096

任何人都可以帮助我生成与金字塔服务器 greps 相同的 tid。欢迎任何线索或方向。

如果我使用 pyramid-cookiecutter-starter 模板开始一个新项目并修改日志记录以便输出线程标识,那么一切都会按预期匹配。

cookiecutter gh:Pylons/pyramid-cookiecutter-starter
cd scaffold
python3 -m venv env
env/bin/pip install -e .
# edit files as below
env/bin/pserve development.ini
# open browser and visit http://localhost:6543/

# views.py
from pyramid.view import view_config
import threading

log = __import__('logging').getLogger(__name__)

@view_config(route_name='home', renderer='templates/mytemplate.jinja2')
def my_view(request):
    log.info('hello from thread=%s', threading.currentThread().ident)
    return {'project': 'Pyramid Scaffold'}


# development.ini
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(thread)s] %(message)s


2017-03-09 13:47:14,996 INFO  [scaffold.views:8][123145480736768] hello from thread=123145480736768
2017-03-09 13:47:17,145 INFO  [scaffold.views:8][123145489149952] hello from thread=123145489149952
2017-03-09 13:47:17,504 INFO  [scaffold.views:8][123145480736768] hello from thread=123145480736768
2017-03-09 13:47:17,745 INFO  [scaffold.views:8][123145489149952] hello from thread=123145489149952
2017-03-09 13:47:17,945 INFO  [scaffold.views:8][123145480736768] hello from thread=123145480736768
2017-03-09 13:47:18,138 INFO  [scaffold.views:8][123145484943360] hello from thread=123145484943360
2017-03-09 13:47:18,311 INFO  [scaffold.views:8][123145489149952] hello from thread=123145489149952
2017-03-09 13:47:18,496 INFO  [scaffold.views:8][123145493356544] hello from thread=123145493356544
2017-03-09 13:47:18,717 INFO  [scaffold.views:8][123145480736768] hello from thread=123145480736768
2017-03-09 13:47:18,846 INFO  [scaffold.views:8][123145489149952] hello from thread=123145489149952

我需要您提供一个可重现的示例,就像我在这里提供的那样,以了解您的实际要求。