Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

[Review please!] Logging refactor / cleanup #415

Closed
wants to merge 4 commits into from

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented Nov 23, 2015

This is a work-in-progress.

It currently looks like this:
logging

DONE!

Review away :)

@cdrage cdrage force-pushed the new-logging branch 2 times, most recently from 1da2472 to d6c9d1e Compare November 23, 2015 17:24
@landscape-bot
Copy link

Code Health
Repository health increased by 2% when pulling d6c9d1e on cdrage:new-logging into 5504ddf on projectatomic:master.

@landscape-bot
Copy link

Code Health
Repository health increased by 2% when pulling 19e2aaf on cdrage:new-logging into 5504ddf on projectatomic:master.

@dustymabe
Copy link
Contributor

Should the [OK] messages in your picture of example output be [INFO] instead?

@landscape-bot
Copy link

Code Health
Repository health increased by 2% when pulling f0f21e2 on cdrage:new-logging into 5504ddf on projectatomic:master.

@cdrage
Copy link
Member Author

cdrage commented Nov 24, 2015

@dustymabe Yeah, it should :), I'll fix that.

@landscape-bot
Copy link

Code Health
Repository health increased by 2% when pulling 3434eaa on cdrage:new-logging into 5504ddf on projectatomic:master.

@rtnpro rtnpro added the GA label Nov 25, 2015
@rtnpro rtnpro added this to the CDK 2 GA milestone Nov 25, 2015
@rtnpro rtnpro removed the GA label Nov 25, 2015
@cdrage cdrage force-pushed the new-logging branch 8 times, most recently from 1ca21f2 to ffd768a Compare December 2, 2015 23:38
@sub-mod sub-mod mentioned this pull request Dec 8, 2015
@sub-mod
Copy link
Contributor

sub-mod commented Dec 11, 2015

@cdrage
All the display messages cannot be shown on UI. I would like a method where I can add cockpit specific message like display("step 1 completed", cockpit=true) and these messages should show up when i put cockpit flag

also, can journald output be another PR so that we can have some code for me to test with cockpit

@cdrage
Copy link
Member Author

cdrage commented Dec 11, 2015

Yup. JournalD will be another PR. At the moment its not possible.

I'll update the PR and add a function for cockpit only info messages so you
can at least test it with cockpit.
On Dec 11, 2015 1:23 PM, "sub-mod" [email protected] wrote:

@cdrage https://github.com/cdrage
All the display messages cannot be shown on UI. I would like a method
where I can add cockpit specific message like display("step 1 completed",
cockpit=true) and these messages should show up when i put cockpit flag

also, can journald output be another PR so that we can have some code for
me to test with cockpit


Reply to this email directly or view it on GitHub
#415 (comment)
.

@cdrage cdrage force-pushed the new-logging branch 2 times, most recently from 0cc39f4 to 9b7b496 Compare December 21, 2015 17:21
@cdrage cdrage force-pushed the new-logging branch 2 times, most recently from 1bcee57 to a9ebb56 Compare February 17, 2016 18:33
return input


def set_logging(args):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's modify this to take vars as input. Looks like the few that we use are: verbose, quiet, and logging_output.

That way we aren't coupled to changes in cli/main.py.

@cdrage cdrage force-pushed the new-logging branch 2 times, most recently from 8172d95 to 3edb100 Compare February 17, 2016 23:27
@cdrage
Copy link
Member Author

cdrage commented Feb 17, 2016

Okay so I've gone ahead and pushed all my other commits.

I have one failing error right now that could be due to a bug in the test suite. Otherwise, good for another review!

return

if code == LOG_LEVELS['debug']:
msg = "[DEBUG] %6d %0.2f %s" % (os.getpid(), time.time(), msg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After running it a couple of times I feel like the extra output in the debug statements (the pid/time) doesn't really help debug anything any more. We don't run multiprocess so I don't think this is useful. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dustymabe updated. yeah, too much output!

@dustymabe
Copy link
Contributor

So one really nice thing (for me) about the old output is that it included the name of the file in the output:

[root@f23 redis-centos7-atomicapp (upstreammaster *%=)]# aa run ./ --provider kubernetes                                                                                                                                                                                       
2016-02-17 20:37:21,499 - __main__ - INFO - Action/Mode Selected is: run
2016-02-17 20:37:21,532 - atomicapp.plugin - WARNING - Configuration option 'providerconfig' not found
2016-02-17 20:37:21,532 - atomicapp.plugin - WARNING - Configuration option 'providerconfig' not found
2016-02-17 20:37:21,532 - kubernetes - INFO - Using namespace default
2016-02-17 20:37:21,532 - kubernetes - INFO - trying kubectl at /host/usr/bin/kubectl
2016-02-17 20:37:21,533 - kubernetes - INFO - found kubectl at /host/usr/bin/kubectl
2016-02-17 20:37:21,535 - kubernetes - INFO - Deploying to Kubernetes
2016-02-17 20:37:21,808 - atomicapp.plugin - WARNING - Configuration option 'providerconfig' not found
2016-02-17 20:37:21,808 - kubernetes - INFO - Using namespace default
2016-02-17 20:37:21,809 - kubernetes - INFO - trying kubectl at /host/usr/bin/kubectl
2016-02-17 20:37:21,809 - kubernetes - INFO - found kubectl at /host/usr/bin/kubectl
2016-02-17 20:37:21,810 - kubernetes - INFO - Deploying to Kubernetes

Is there a way to preserve that with the new system?

@cdrage cdrage changed the title [WIP] Logging refactor / cleanup! [Review please!] Logging refactor / cleanup Feb 18, 2016
@cdrage cdrage force-pushed the new-logging branch 2 times, most recently from e36e4d0 to e5b9b43 Compare February 18, 2016 14:56
@cdrage
Copy link
Member Author

cdrage commented Feb 18, 2016

@rtnpro @dustymabe

Hey all!

So I've updated the PR for final review.

One thing to note is that I will be removing the syslog logging output provider until a later date. I want to do more thorough testing with that.

I've also had to move a few things around in main.py in order to get the logging to output correctly. I checked to see if it would do any harm and from the looks if it, it wouldn't.

Otherwise, feel free to review and test!

custom_level = LOG_LEVELS[logging_output]
break
else:
custom_level = LOG_LEVELS['default']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOG_LEVELS is a list right? could we do something like this:

if logging_output in LOG_LEVELS:
    custom_level = LOG_LEVELS[logging_output]
else:
    custom_level = LOG_LEVELS['default'] 

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dustymabe Ahhhhh, forgot Python had that functinon >.> I'll add it

@cdrage
Copy link
Member Author

cdrage commented Feb 18, 2016

@dustymabe updated based on your comments for the for loop

@dustymabe
Copy link
Contributor

Closing in favor of #565

@dustymabe dustymabe closed this Feb 19, 2016
@cdrage cdrage deleted the new-logging branch February 21, 2016 01:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants