命令行选项--log-level = INFO被pyinstaller忽略

时间:2015-12-09 12:56:25

标签: python pyinstaller

我正在尝试使用pyinstaller构建可执行文件并在构建时设置日志级别,但程序似乎忽略了参数--log-level=DEBUG

这是我的脚本test.py

import logging
def run():
    logging.info('TEST INFO')
    logging.debug('TEST DEBUG')
    logging.warning('TEST WARNING')
    logging.critical('TEST CRITICAL')

    print 'TEST PRINT'

if __name__ == '__main__':
    run()

所以我构建了可执行文件:

pyinstaller --log-level=DEBUG --onefile --clean test.py

如果我运行二进制文件,它只会在控制台上打印警告和关键消息,忽略信息和调试,无论选项是什么--log-level:

$ dist/test 
WARNING:root:TEST WARNING
CRITICAL:root:TEST CRITICAL
TEST PRINT

我做错了什么?

Ubuntu 14.04上的Python 2.7.6和pyinstaller 3.0

1 个答案:

答案 0 :(得分:2)

根据PyIntaller documentation SetEnv GIT_PROJECT_ROOT C:/Repositories SetEnv GIT_HTTP_EXPORT_ALL SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER ScriptAliasMatch \ "(?x)^/(.*/(HEAD | \ info/refs | \ objects/(info/[^/]+ | \ [0-9a-f]{2}/[0-9a-f]{38} | \ pack/pack-[0-9a-f]{40}\.(pack|idx)) | \ git-(upload|receive)-pack))$" \ "C:/Program Files/Git/mingw64/libexec/git-core/git-http-backend.exe/$1" # Authentication <LocationMatch "^/.*/git-receive-pack$"> Options +ExecCGI #Options +Indexes +FollowSymLinks +ExecCGI AuthType Basic AuthName "Git Login" AuthUserFile "C:/Apache24/bin/gituserpass.git" Require user ensys Require valid-user </LocationMatch> <LocationMatch "^/.*/git-upload-pack$"> Options +ExecCGI #Options +Indexes +FollowSymLinks +ExecCGI AuthType Basic AuthName "Git Login" AuthUserFile "C:/Apache24/bin/gituserpass.git" Require user ensys </LocationMatch> <Directory /> Require all granted </Directory> 定义“构建时控制台消息中的详细信息量”。因此,此选项不会设置构建的应用程序----log-level=LOGLEVEL的日志级别,但只会使PyInstaller更加/更简洁。