Hi guys,
Problem: I need to log some actions to a file when they are performed, but only this specific messages and nothing else.
I create the settings to log to a file and it worked, but write my messages and a bunch of trash.
Settings.py
LOGGING = {
# Define the logging version
'version': 1,
# Enable the existing loggers
'disable_existing_loggers': False,
# Define the handlers
'handlers': {
'file': {
'class': 'logging.FileHandler',
'filename': 'djangoapp.log',
},
'console': {
'class': 'logging.StreamHandler',
},
},
# Define the loggers
'loggers': {
'django': {
'handlers': ['file'],
'level': 'INFO',
'propagate': False,
},
},
}
and in my function a call
logger = logging.getLogger('django')
logger.info("Test!!")
this solution write the string “Test!!” but write all level info stuff to.
It is the wrong approach? or something is missing me?
Gonçalo Marques