Merge lp:~jaypipes/glance/bug746435 into lp:~glance-coresec/glance/cactus-trunk

Proposed by Jay Pipes
Status: Merged
Approved by: Jay Pipes
Approved revision: 102
Merged at revision: 103
Proposed branch: lp:~jaypipes/glance/bug746435
Merge into: lp:~glance-coresec/glance/cactus-trunk
Diff against target: 15 lines (+3/-3)
1 file modified
glance/registry/db/api.py (+3/-3)
To merge this branch: bzr merge lp:~jaypipes/glance/bug746435
Reviewer Review Type Date Requested Status
Eldar Nugaev (community) Approve
Andrey Brindeyev (community) Approve
Rick Harris (community) Approve
Review via email: mp+56235@code.launchpad.net

Description of the change

Use logging module, not echo, for logging SQLAlchemy. Fixes bug 746435.

To post a comment you must log in.
Revision history for this message
Rick Harris (rconradharris) wrote :

lgtm

review: Approve
Revision history for this message
Andrey Brindeyev (abrindeyev) wrote :

lgtm

review: Approve
Revision history for this message
Eldar Nugaev (reldan) wrote :

+ if verbose:
28 + logger.setLevel(logging.INFO)
29 + elif debug:
30 + logger.setLevel(logging.DEBUG)

Should be replaced by

if debug:
    logger.setLevel(logging.DEBUG)
elif verbose:
    logger.setLevel(logging.INFO)

for case verbose=True, Debug=True

review: Needs Fixing
Revision history for this message
Jay Pipes (jaypipes) wrote :

Elgar, that would mean the --debug would be ignored. Is that what you really want? I was thinking taking the more verbose setting (--debug) over the less verbose one in the case that both were specified is the better choice?

Revision history for this message
Jay Pipes (jaypipes) wrote :

hold on... I'm not sure there would be any difference in either case...

Revision history for this message
Eldar Nugaev (reldan) wrote :

INFO level doesn't include DEBUG messages, but DEBUG level includes DEBUG messages.
There is my examples

example1:

verbose = True
debug = True
logger = logging.getLogger('test')
if debug:
    logger.setLevel(logging.DEBUG)
elif verbose:
    logger.setLevel(logging.INFO)

logger.debug("DEBUG")
logger.info("INFO")

output:
DEBUG:test:DEBUG
INFO:test:INFO

example2:

verbose = True
debug = True
logger = logging.getLogger('test')
if verbose:
    logger.setLevel(logging.INFO)
elif debug:
    logger.setLevel(logging.DEBUG)

logger.debug("DEBUG")
logger.info("INFO")

output:
INFO:test:INFO

Revision history for this message
Eldar Nugaev (reldan) wrote :

I make typo "debug level includes info" instead of "DEBUG level includes DEBUG messages."
Sorry :)

Revision history for this message
Jay Pipes (jaypipes) wrote :

Example 1 is what we wanted.

Revision history for this message
Jay Pipes (jaypipes) wrote :

I'll post another commit. thx for pointing this out, Elgar.

Revision history for this message
Eldar Nugaev (reldan) wrote :

Thank you, Jay )

Revision history for this message
Eldar Nugaev (reldan) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'glance/registry/db/api.py'
2--- glance/registry/db/api.py 2011-04-04 17:58:38 +0000
3+++ glance/registry/db/api.py 2011-04-06 15:19:31 +0000
4@@ -69,10 +69,10 @@
5 _ENGINE = create_engine(options['sql_connection'],
6 pool_recycle=timeout)
7 logger = logging.getLogger('sqlalchemy.engine')
8- if verbose:
9+ if debug:
10+ logger.setLevel(logging.DEBUG)
11+ elif verbose:
12 logger.setLevel(logging.INFO)
13- elif debug:
14- logger.setLevel(logging.DEBUG)
15 register_models()
16
17

Subscribers

People subscribed via source and target branches