Add debug env variable
Allow setting the debug flag from an environment variable for the convenience of users running in a container. Also standardize the log format. Change-Id: Icbf344029745938c69c43805484fb7d676d797fb
This commit is contained in:
parent
6722875907
commit
b356d6ceed
@ -14,6 +14,7 @@
|
|||||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import cherrypy
|
import cherrypy
|
||||||
@ -332,10 +333,11 @@ def main():
|
|||||||
help='Command: serve, prune',
|
help='Command: serve, prune',
|
||||||
default='serve')
|
default='serve')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.debug:
|
logformat = '%(levelname)s %(name)s: %(message)s'
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
if args.debug or os.environ.get('DEBUG') == '1':
|
||||||
|
logging.basicConfig(level=logging.DEBUG, format=logformat)
|
||||||
else:
|
else:
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO, format=logformat)
|
||||||
cherrypy.log.access_log.propagate = False
|
cherrypy.log.access_log.propagate = False
|
||||||
logging.getLogger("requests").setLevel(logging.DEBUG)
|
logging.getLogger("requests").setLevel(logging.DEBUG)
|
||||||
logging.getLogger("keystoneauth").setLevel(logging.ERROR)
|
logging.getLogger("keystoneauth").setLevel(logging.ERROR)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user