https://dagster.io/ logo
#ask-community
Title
# ask-community
m

Mark

03/13/2023, 10:02 AM
Good morning all, I have a (probably) simple question of how to disable debug level logs while running unittests. I run my unittests with
python -m unittest -v
and while it's perfectly picking up all tests and running them properly, it's a bit difficult to read due to the built in DEBUG logs that are generated on every asset creation. While I prefer to only surpress these debugs during unittests, I've tried adding the following to my `DAGSTER_HOME\dagster.yaml`:
Copy code
python_logs:
  python_log_level: INFO
but that didn't help (debug messages still visible). It did disable them in dagit though (which is actually what I didn't want :)). I've also tried:
Copy code
import logging
from dagster import get_dagster_logger

class TestMyTestCase(unittest.TestCase):
    ...

if __name__ == "__main__":
    logger = get_dagster_logger()
    logger.setLevel(<http://logging.INFO|logging.INFO>)
    unittest.main()
This also didn't seem to help. I'd also prefer it if I can set the logging info on one location for all unit tests, rather than every file that contains tests (as I'm seperating my tests over multiple files). Any suggestions?
y

yuhan

03/13/2023, 4:34 PM
one way could be to configure a dagster instance just for tests and configure the log level just for that instance. then, every time you execute in tests, you specify to use that instance.
17 Views