logging library doesn't seem to work with spyder
See original GitHub issueHello,
I’m trying to run a script using python standard library ‘logging’. This script works fine from the command line but when run from Spyder, no log is printed.
My configuration is: Windows 7 Python 2.7.10 :: Anaconda 2.3.0 (64-bit) spyder-app 2.3.5.2
The script is:
# -*- coding: utf-8 -*-
"""
Simple test using logging
"""
import logging
# Logger configuration:
log_level = logging.DEBUG
log_format = '%(levelname)s:%(message)s'
# Testing logger
logger = logging.root
logger.basicConfig = logging.basicConfig(format=log_format, filename='test.log', level=log_level)
logger.info('Testing logger (info)')
logger.debug('Testing logger (debug)')
logger.warning('Testing logger (warn)')
logger.info("")
Issue Analytics
- State:
- Created 8 years ago
- Comments:34 (13 by maintainers)
Top Results From Across the Web
logging library doesn't seem to work well with spyder #14651
I'm trying to run a script using python standard library 'logging' module. This script works fine from Python IDE but when run from...
Read more >Unexplained behaviour of python logging in spyder that differs ...
I am really struggling with Python's logging library, which seems so promising. This is perhaps in part because I typically use Spyder IDE....
Read more >logging — Logging facility for Python — Python 3.11.1 ...
The key benefit of having the logging API provided by a standard library module is ... so that the next formatter to handle...
Read more >Common Illnesses — Spyder 5 documentation
If you receive the message An error occurred while starting the kernel in the IPython Console, Spyder was unable to launch a new...
Read more >Python Tutorial: Logging Basics - Logging to Files ... - YouTube
In this Python Tutorial, we will be going over the basics of logging. We will learn how to switch out our print statements...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks! force=True worked on my system Mac, Python 3.8.1, Spyder 4.1.3)
@gokhalen, your use case also seems fixed in Python 3.8, by passing a new parameter called
force=True
tobasicConfig
so it can be reset each time you run new code.