Every line of 'python logging file location' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
80 def configureLogging(): 81 82 # compute the log filename 83 fullpath = inspect.stack()[1][1] 84 filename = (os.path.split(fullpath)[-1]).split('.')[0] 85 logfilename = '{0}.log'.format(filename) 86 87 # find the log configuration file, if any 88 logconf = None 89 for p in [ 90 os.path.join('.', 'logging.conf'), 91 os.path.join('..', 'logging.conf'), 92 os.path.join('app','logging.conf'), 93 ]: 94 if os.path.exists(p): 95 logconf = p 96 break 97 98 # start logging 99 if logconf: 100 logging.config.fileConfig( 101 fname = logconf, 102 defaults = { 103 'logfilename': logfilename, 104 } 105 ) 106 else: 107 print "WARNING: no log configuration file could be found."
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code