-
Notifications
You must be signed in to change notification settings - Fork 234
logging not captured #402
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Hi @zsluedem, Thanks for the report. If you force one of the tests to fail and use def test_3():
logger.warning('123123')
assert 0
I'm using |
Hi @nicoddemus. Could you link the issue that @RonnyPfannschmidt is working on? |
Sure, it is actually a "project" involving a lot of issues: https://github.com/pytest-dev/pytest/projects/2 |
@nicoddemus and @RonnyPfannschmidt : Can you please let me know , when this issue will be resolved , as we are facing issues due to this . Awaiting your reply . |
Hi @sagardaine, Unfortunately @RonnyPfannschmidt is a hiatus right now, so this work is halted at the moment. @RonnyPfannschmidt can provide more information about when he plans to get back to this. |
Indeed it is a initialization problem, reproducible example: import logging
logger = logging.getLogger('foo')
def test_3():
logger.info('123123')
assert 0 [pytest]
log_cli=true
log_cli_level=DEBUG
|
Hmm on the other hand, I just noticed that not using [pytest]
log_level=DEBUG
So it does not seem to be a problem with initialization, but with capturing output on workers, which is a long standing issue and hard to fix (#296). |
I'm running into this as well. I need my fixtures to print out INFO level logs, but they are never seen, nor are ERROR level during a successful run (tried, just to see). v1.30.0 |
Hey, I have the same request related to this ticket. I need the tests and fixtures to print out INFO level logs since some logs are important for people to check. Do not know if there is a solution right now. Thanks. |
one year 7 months later, someone has found a workaround? pytest-xdist is too much important for me ( many thanks pytest-xdist plugin developers <3 ) but i need to store DEBUG logs in a file and output ERROR log in console. for now , it is only possible to store anything in the file but obtain console output only if test is failing, right? many thanks. |
mmh i think not, log area overwritten and corrupted, for example this is a log without xdist
this is with -n auto
you see "cal" is a piece of a row or log, and you get only 4 |
Yes that is right: we can't transmit arbitrary output from workers easily under the current |
thanks @nicoddemus but not sure, in my use case, file logging will be corrupted (see the previous comment), so with xdist is never possible to log anything, console or file. If you think logging to file should work, maybe there is something wrong in my configuration. Another question is "why does pytest-logger is working with xdist?" |
If anyone stumbles upon this, there is a workaround. Use import sys
sys.stdout = sys.stderr Use this only for debugging purposes. |
@arizzubair sorry I tried this solution but I couldn't figure out how to make it work. I guess this is not a replacement for Live Logs? Any way, there are no available solution yet to show live logs? |
@JonesKenzie , did you use |
Mark it and I'll try again if it solves the problem,thanks. |
This provides incremental output when test is running _without xdist_, just like the old runner did. With xdist the live output is not available, I believe because of pytest-dev/pytest-xdist#402 pytest-dev/pytest-xdist#883 might help with that, but I'm not going to hold my breath until it is available on distros we use.
This provides incremental output when test is running _without xdist_, just like the old runner did. With xdist the live output is not available, I believe because of pytest-dev/pytest-xdist#402 pytest-dev/pytest-xdist#883 might help with that, but I'm not going to hold my breath until it is available on distros we use.
This provides incremental output when test is running _without xdist_, just like the old runner did. With xdist the live output is not available, I believe because of pytest-dev/pytest-xdist#402 pytest-dev/pytest-xdist#883 might help with that, but I'm not going to hold my breath until it is available on distros we use.
This provides incremental output when test is running _without xdist_, just like the old runner did. With xdist the live output is not available, I believe because of pytest-dev/pytest-xdist#402 pytest-dev/pytest-xdist#883 might help with that, but I'm not going to hold my breath until it is available on distros we use.
This provides incremental output when test is running _without xdist_, just like the old runner did. With xdist the live output is not available, I believe because of pytest-dev/pytest-xdist#402 pytest-dev/pytest-xdist#883 might help with that, but I'm not going to hold my breath until it is available on distros we use. (cherry picked from commit d0619c7)
test_5.py file content
pytest.ini
run
pytest test/test_5 -n auto
logs:
There are no logs print out.
I saw #256 , but it doesn't help
The text was updated successfully, but these errors were encountered: