Merge lp:~thomir-deactivatedaccount/uservice-logging/trunk-fix-print into lp:uservice-logging

Proposed by Thomi Richards on 2015-09-01
Status: Merged
Merged at revision: 25
Proposed branch: lp:~thomir-deactivatedaccount/uservice-logging/trunk-fix-print
Merge into: lp:uservice-logging
Diff against target: 31 lines (+12/-8)
1 file modified
uservice_logging/logging.py (+12/-8)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/uservice-logging/trunk-fix-print
Reviewer Review Type Date Requested Status
Celso Providelo (community) 2015-09-01 Approve on 2015-09-02
Review via email: mp+269823@code.launchpad.net

Commit message

Fix a bug in the printed message about falling back to stderr for the application log if no log file was specified.

Description of the change

Fix a bug in the printed message about falling back to stderr for the application log if no log file was specified.

To post a comment you must log in.
Celso Providelo (cprov) wrote :

Thanks Thomi,

Looks good, however as we discussed during the standup, I don't think we should go over the pip-cache-dance over all services in the release day just for more accurate message logging.

review: Approve

Celso,

I agree. I'll land this now, and it can get rolled into the next release.

Tanuki Bot (tanuki-bot) wrote :

The attempt to merge lp:~thomir/uservice-logging/trunk-fix-print into lp:uservice-logging failed. Below is the output from the failed tests.

virtualenv -p python3 env
Using base prefix '/usr'
New python executable in env/bin/python3
Also creating executable in env/bin/python
Installing setuptools, pip...done.
Running virtualenv with interpreter /usr/bin/python3
env/bin/pip install -q -r test_requirements.txt
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement testtools==1.7.1 (from -r test_requirements.txt (line 1))
No distributions at all found for testtools==1.7.1 (from -r test_requirements.txt (line 1))
Storing debug log for failure in /home/tarmac/.pip/pip.log

make: *** [bootstrap] Error 1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'uservice_logging/logging.py'
2--- uservice_logging/logging.py 2015-08-20 16:48:42 +0000
3+++ uservice_logging/logging.py 2015-09-01 23:31:14 +0000
4@@ -113,15 +113,19 @@
5 requests_logger.setLevel(logging.WARNING)
6
7 # If there is no .directory for the file, fall back to stderr logging
8- if log_file_path and os.path.exists(os.path.dirname(log_file_path)):
9- handler = logging.handlers.TimedRotatingFileHandler(
10- log_file_path,
11- when='D',
12- interval=1
13- )
14+ if log_file_path:
15+ if os.path.exists(os.path.dirname(log_file_path)):
16+ handler = logging.handlers.TimedRotatingFileHandler(
17+ log_file_path,
18+ when='D',
19+ interval=1
20+ )
21+ else:
22+ print("parent directory for log '{}' does not exist, using stderr "
23+ "for app log.".format(log_file_path))
24+ handler = logging.StreamHandler()
25 else:
26- print("parent directory for log '{}' does not exist, using stderr "
27- "for app log.".format(log_file_path))
28+ print("No log file path given, using stderr for app log.")
29 handler = logging.StreamHandler()
30
31 handler.setFormatter(

Subscribers

People subscribed via source and target branches

to all changes: