I am a newbie in Django. I have a website created with Django + Apache. I imported logging module and print some intermediate values with logging error function. But I don't know where the logging file locates. The OS is Ubuntu.
I searched internet and could not find a good answer (Maybe I did not do it properly). Could someone tell me where can I find the logging file that contains the values I logged in the code?
Thanks.
Keep this in your settings and the filename specifies the location of the file
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'file_userlogins': { # define and name a handler
'level': 'DEBUG',
'class': 'logging.FileHandler', # set the logging class to log to a file
'formatter': 'verbose', # define the formatter to associate
'filename': os.path.join(VENV_ROOT, 'log', 'userlogins.log') # log file
},
'loggers': {
'logview.userlogins': { # define a logger - give it a name
'handlers': ['file_userlogins'], # specify what handler to associate
'level': 'INFO', # specify the logging level
'propagate': True,
},
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.