1👍
Although you are setting the configuration for a logger, you aren’t logging the info into the file:
import logging
logger = logging.getLogger(__name__)
logger.info("blah blah blah") # Or loggger.error(..), or whatever
I would recommend getting a closer look to the docs (the link goes to the specific part of using this logger
object).
What I truly unknown is how to add a signal when running the development server to trigger the piece of code above.
1👍
As you can see in https://docs.djangoproject.com/en/dev/topics/logging/#using-logging
Once you have configured your loggers, handlers, filters and formatters, you need to place logging calls into your code. Using the logging framework is very simple.
So what you see in your console is not really logging but something else
If you want to get the stuff in your console into my file you can use pipe and tee
:
[the command you want to run] | tee you_log_file.log
For example:
ifconfig | tee ifconfig.log
you will get the output in your console and the file ifconfig.log.
0👍
What’s your code for logging logs? You need to obtain logger for logging into specified logger.
I notice that you don’t even give a name to your logger, so I suppose you just use “logging.error, logging.debug, etc”
‘loggers’: {
”: {
‘level’: ‘DEBUG’,
‘handlers’: [‘console’,’applogfile’]
},
- [Answered ]-Notify user about bounced confirmation emails
- [Answered ]-How to separate a database from a Django web-app when going live?
- [Answered ]-Add warning message in django-rest-framework
- [Answered ]-I have a list of objects and would like to return an attribute with another attribute