Reputation: 1825
I am trying to log some data to a local file like so:
import logging
# dont know if format parameter is really necessary here
logging.basicConfig(filename='logs/server_logs.log', filemode='a', format='%(message)s')
logging.info("some data")
This code did generate 0 kb "server_logs.log" file, but it stays empty, no text gets appended to it. Am I doing something wrong?
Upvotes: 2
Views: 251
Reputation: 34046
You need to set this:
logger = logging.getLogger()
logger.setLevel(logging.INFO)
Upvotes: 6