-
Notifications
You must be signed in to change notification settings - Fork 26
Patch for issue #48 Enable logging of SQL statements #173
Conversation
Ah, good find - that would get us logging instead of printing which would definitely be more readable. Do you want to switch the pull req to adopt your suggestion? Looks like Travis noticed some pep8 failures, too. You can run |
And thanks, and welcome! |
@djmitche Ok I am making changes for second implementation. |
@@ -15,6 +15,10 @@ | |||
# configuration is present, is to use '*.db' files in the directory containing | |||
# the RelengAPI source code. | |||
|
|||
# flag for SQLALCHEMY log | |||
# deafult it is true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo in comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Callek oh I missed the spelling. Thanks
If I run this as-is, then everything gets logged twice:
The main issue here is that the logging configuration is done at the top level of the module, so that it only happens once, and before the app configuration is loaded. In fact, setup of the Python A few other minor notes:
|
@rahulrrixe I didn't mean to scare you away with all that! |
@djmitche haha 👍 BTW I am not scared. Yesterday I caught up with some work at University. The problem: I am facing is that I am not able to authenticate on api services and so not able to see the log and debug it. So can you help how can I setup the authentication to get admin rights. Also while building docs I am getting this error (releng)MC-INMU-DIM042L:build-relengapi rranjan$ relengapi build-docs
2015-01-31 03:01:49,372 Using default settings; to configure relengapi, set RELENGAPI_SETTINGS to point to your settings file
2015-01-31 03:01:49,830 registering blueprint badpenny
2015-01-31 03:01:49,832 registering blueprint base
2015-01-31 03:01:49,832 registering blueprint tokenauth
2015-01-31 03:01:49,834 The `SECRET_KEY` setting is not set; tokens will be signed with an insecure, static key
2015-01-31 03:01:49,834 registering blueprint auth
2015-01-31 03:01:49,835 registering blueprint docs
2015-01-31 03:01:49,977 docs have not been built
2015-01-31 03:01:49,978 setting per-process session key - sessions will be reset on process restart
Running Sphinx v1.3b2
Traceback (most recent call last):
File "/Users/rranjan/.virtualenvs/releng/bin/relengapi", line 9, in <module>
load_entry_point('relengapi==1.1.0', 'console_scripts', 'relengapi')()
File "/Users/rranjan/.virtualenvs/releng/lib/python2.7/site-packages/relengapi-1.1.0-py2.7.egg/relengapi/lib/subcommands.py", line 62, in main
args._subcommand.run(parser, args)
File "/Users/rranjan/.virtualenvs/releng/lib/python2.7/site-packages/relengapi-1.1.0-py2.7.egg/relengapi/blueprints/docs/__init__.py", line 134, in run
support.build()
File "/Users/rranjan/.virtualenvs/releng/lib/python2.7/site-packages/Sphinx-1.3b2-py2.7.egg/sphinx/websupport/__init__.py", line 121, in build
'websupport', status=self.status, warning=self.warning)
File "/Users/rranjan/.virtualenvs/releng/lib/python2.7/site-packages/Sphinx-1.3b2-py2.7.egg/sphinx/application.py", line 125, in __init__
confoverrides or {}, self.tags)
File "/Users/rranjan/.virtualenvs/releng/lib/python2.7/site-packages/Sphinx-1.3b2-py2.7.egg/sphinx/config.py", line 236, in __init__
with cd(dirname):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/Users/rranjan/.virtualenvs/releng/lib/python2.7/site-packages/Sphinx-1.3b2-py2.7.egg/sphinx/util/osutil.py", line 210, in cd
os.chdir(target_dir)
OSError: [Errno 2] No such file or directory: '/Users/rranjan/.virtualenvs/releng/relengapi-docs' I think that target directory should be |
To set up authentication, put something like this in your
Then you should be able to login using browserid. I'm not sure what to make of the docs error, but let's get another issue on file to take care of that separately. |
@rahulrrixe how's this going? |
@djmitche sorry for this much delay, I had to join MIT media lab workshop for around one and half week and so I could't able to work on it as I returned back from there yesterday. I will complete this today and thank you for pinging me for this 👍 |
@@ -18,7 +18,17 @@ | |||
from sqlalchemy.orm import scoping | |||
from sqlalchemy.pool import Pool | |||
|
|||
LEVELS = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the different levels for log
@rahulrrixe I haven't heard from you in three weeks or so -- any chance you'll get time to finish this up? |
remove trailing spaces new logger add sqlalchemy flag echo_pool for sqlalchemy logging remove typo error update sqlalchemy log correct indentation remove print statement update sqlalchemy logging
@djmitche I am really sorry on this. I had kept this pr open for so long time. |
Closed in favor of #212 |
@djmitche another way to do this is. Let me know which would be preferred.