Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from go-logging to logrus #961

Merged
merged 7 commits into from May 21, 2018
Merged

Switch from go-logging to logrus #961

merged 7 commits into from May 21, 2018

Conversation

jmrodri
Copy link
Contributor

@jmrodri jmrodri commented May 19, 2018

Switching from go-logging to use logrus which will match
bundle-lib and make our logs a bit more consistent. The one things that doesn't quite work is color log output.

Broker config remains the same except that the color value will be ignored for now because of the formatting from logrus.
See the comment below to see what I mean.

@openshift-ci-robot openshift-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 19, 2018
@jmrodri
Copy link
Contributor Author

jmrodri commented May 19, 2018

OLD log file, shows the broker logs using go-logging and the logs from bundle-lib which use logrus

Using config file mounted to /etc/ansible-service-broker/config.yaml
============================================================
==           Creating Ansible Service Broker...           ==
============================================================
[2018-05-18T22:36:39.37Z] [NOTICE] - Initializing clients...
[2018-05-18T22:36:39.371Z] [DEBUG] - Connecting to Cluster
time="2018-05-18T22:36:39Z" level=info msg="OpenShift version: %vv3.10.0-alpha.0+18dfae9-1209"
time="2018-05-18T22:36:39Z" level=info msg="unable to retrieve the network plugin, defaulting to not joining networks - clusternetworks.network.openshift.io \"default\" not found"
time="2018-05-18T22:36:39Z" level=info msg="Kubernetes version: %vv1.10.0+b81c8f8"
time="2018-05-18T22:36:39Z" level=info msg="== REGISTRY CX == "
time="2018-05-18T22:36:39Z" level=info msg="Name: dh"
time="2018-05-18T22:36:39Z" level=info msg="Type: dockerhub"
time="2018-05-18T22:36:39Z" level=info msg="Url: docker.io"
time="2018-05-18T22:36:39Z" level=info msg="== REGISTRY CX == "
time="2018-05-18T22:36:39Z" level=info msg="Name: localregistry"
time="2018-05-18T22:36:39Z" level=info msg="Type: local_openshift"
time="2018-05-18T22:36:39Z" level=info msg="Url: "
[2018-05-18T22:36:39.38Z] [DEBUG] - Connecting Dao
[2018-05-18T22:36:39.38Z] [DEBUG] - Connecting Registry
[2018-05-18T22:36:39.381Z] [DEBUG] - Initializing WorkEngine
[2018-05-18T22:36:39.382Z] [DEBUG] - Creating AnsibleBroker
============================================================
==           Starting Ansible Service Broker...           ==
============================================================
[2018-05-18T22:36:39.383Z] [INFO] - Initiating Recovery Process
[2018-05-18T22:36:39.408Z] [INFO] - Recovery complete
[2018-05-18T22:36:39.409Z] [NOTICE] - recover called
[2018-05-18T22:36:39.409Z] [INFO] - Broker configured to bootstrap on startup
[2018-05-18T22:36:39.409Z] [INFO] - Attempting bootstrap...
[2018-05-18T22:36:39.409Z] [INFO] - AnsibleBroker::Bootstrap
[2018-05-18T22:36:39.409Z] [DEBUG] - Dao::BatchGetSpecs

old-log-file

@jmrodri
Copy link
Contributor Author

jmrodri commented May 19, 2018

logrus at INFO level only, no color

Using config file mounted to /etc/ansible-service-broker/config.yaml
============================================================
==           Creating Ansible Service Broker...           ==
============================================================
time="2018-05-18T22:15:49Z" level=info msg="Initializing clients..."
time="2018-05-18T22:15:49Z" level=info msg="OpenShift version: %vv3.10.0-alpha.0+18dfae9-1209"
time="2018-05-18T22:15:49Z" level=info msg="unable to retrieve the network plugin, defaulting to not joining networks - clusternetworks.network.openshift.io \"default\" not found"
time="2018-05-18T22:15:49Z" level=info msg="Kubernetes version: %vv1.10.0+b81c8f8"
time="2018-05-18T22:15:49Z" level=info msg="== REGISTRY CX == "
time="2018-05-18T22:15:49Z" level=info msg="Name: dh"
time="2018-05-18T22:15:49Z" level=info msg="Type: dockerhub"
============================================================
time="2018-05-18T22:15:49Z" level=info msg="Url: docker.io"
time="2018-05-18T22:15:49Z" level=info msg="== REGISTRY CX == "
time="2018-05-18T22:15:49Z" level=info msg="Name: localregistry"
time="2018-05-18T22:15:49Z" level=info msg="Type: local_openshift"
time="2018-05-18T22:15:49Z" level=info msg="Url: "
time="2018-05-18T22:15:49Z" level=info msg="Initiating Recovery Process"
==           Starting Ansible Service Broker...           ==
============================================================
time="2018-05-18T22:15:49Z" level=info msg="Recovery complete"
time="2018-05-18T22:15:49Z" level=info msg="recover called"
time="2018-05-18T22:15:49Z" level=info msg="Broker configured to bootstrap on startup"
time="2018-05-18T22:15:49Z" level=info msg="Attempting bootstrap..."
time="2018-05-18T22:15:49Z" level=info msg="AnsibleBroker::Bootstrap"

@mhrivnak
Copy link
Member

You are a hero.

@jmrodri
Copy link
Contributor Author

jmrodri commented May 19, 2018

logrus at DEBUG level for BOTH broker and bundle-lib, no color

Using config file mounted to /etc/ansible-service-broker/config.yaml
============================================================
==           Creating Ansible Service Broker...           ==
============================================================
time="2018-05-19T03:16:59Z" level=info msg="Initializing clients..."
time="2018-05-19T03:16:59Z" level=debug msg="Connecting to Cluster"
time="2018-05-19T03:16:59Z" level=info msg="OpenShift version: %vv3.10.0-alpha.0+18dfae9-1209"
time="2018-05-19T03:16:59Z" level=debug msg="plugin for the network - "
time="2018-05-19T03:16:59Z" level=info msg="unable to retrieve the network plugin, defaulting to not joining networks - clusternetworks.network.openshift.io \"default\" not found"
time="2018-05-19T03:16:59Z" level=info msg="Kubernetes version: %vv1.10.0+b81c8f8"
time="2018-05-19T03:16:59Z" level=debug msg="Connecting Dao"
time="2018-05-19T03:16:59Z" level=debug msg="Connecting Registry"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get user from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get pass from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get images from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get namespaces from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get fail_on_error from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get black_list from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get auth_type from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get auth_name from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get runner from config"
time="2018-05-19T03:16:59Z" level=info msg="== REGISTRY CX == "
time="2018-05-19T03:16:59Z" level=info msg="Name: dh"
time="2018-05-19T03:16:59Z" level=info msg="Type: dockerhub"
time="2018-05-19T03:16:59Z" level=info msg="Url: docker.io"
time="2018-05-19T03:16:59Z" level=debug msg="Creating filter for registry: %sdh"
time="2018-05-19T03:16:59Z" level=debug msg="whitelist: %v[.*-apb$]"
time="2018-05-19T03:16:59Z" level=debug msg="blacklist: %v[]"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get url from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get user from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get pass from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get org from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get tag from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get images from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get fail_on_error from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get black_list from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get auth_type from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get auth_name from config"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get runner from config"
time="2018-05-19T03:16:59Z" level=info msg="== REGISTRY CX == "
time="2018-05-19T03:16:59Z" level=info msg="Name: localregistry"
time="2018-05-19T03:16:59Z" level=info msg="Type: local_openshift"
time="2018-05-19T03:16:59Z" level=info msg="Url: "
time="2018-05-19T03:16:59Z" level=debug msg="Creating filter for registry: %slocalregistry"
time="2018-05-19T03:16:59Z" level=debug msg="whitelist: %v[.*]"
time="2018-05-19T03:16:59Z" level=debug msg="blacklist: %v[]"
time="2018-05-19T03:16:59Z" level=debug msg="Initializing WorkEngine"
time="2018-05-19T03:16:59Z" level=debug msg="Unable to get secrets from config"
time="2018-05-19T03:16:59Z" level=debug msg="Creating AnsibleBroker"
============================================================
==           Starting Ansible Service Broker...           ==
============================================================
time="2018-05-19T03:16:59Z" level=info msg="Initiating Recovery Process"
time="2018-05-19T03:16:59Z" level=info msg="Recovery complete"
time="2018-05-19T03:16:59Z" level=info msg="recover called"
time="2018-05-19T03:16:59Z" level=info msg="Broker configured to bootstrap on startup"
time="2018-05-19T03:16:59Z" level=info msg="Attempting bootstrap..."
time="2018-05-19T03:16:59Z" level=info msg="AnsibleBroker::Bootstrap"

@jmrodri
Copy link
Contributor Author

jmrodri commented May 19, 2018

logrus with color (NOTE: I disabled this because the formatting needs work)

Using config file mounted to /etc/ansible-service-broker/config.yaml
============================================================
==           Creating Ansible Service Broker...           ==
============================================================
INFO[0000] Initializing clients...                      
DEBU[0000] Connecting to Cluster                        
INFO[0000] OpenShift version: %vv3.10.0-alpha.0+18dfae9-1209 
DEBU[0000] plugin for the network -                     
INFO[0000] unable to retrieve the network plugin, defaulting to not joining networks - clusternetworks.network.openshift.io "default" not found 
INFO[0000] Kubernetes version: %vv1.10.0+b81c8f8        
DEBU[0000] Connecting Dao                               
DEBU[0000] Connecting Registry                          
DEBU[0000] Unable to get user from config               
DEBU[0000] Unable to get pass from config               
DEBU[0000] Unable to get images from config             
DEBU[0000] Unable to get namespaces from config         
DEBU[0000] Unable to get fail_on_error from config      
DEBU[0000] Unable to get black_list from config         
DEBU[0000] Unable to get auth_type from config          
DEBU[0000] Unable to get auth_name from config          
DEBU[0000] Unable to get runner from config             
INFO[0000] == REGISTRY CX ==                            
INFO[0000] Name: dh                                     
INFO[0000] Type: dockerhub                              
INFO[0000] Url: docker.io                               
DEBU[0000] Creating filter for registry: %sdh           
DEBU[0000] whitelist: %v[.*-apb$]                       
DEBU[0000] blacklist: %v[]                              
DEBU[0000] Unable to get url from config                
DEBU[0000] Unable to get user from config               
DEBU[0000] Unable to get pass from config               
DEBU[0000] Unable to get org from config                
DEBU[0000] Unable to get tag from config                
DEBU[0000] Unable to get images from config             
DEBU[0000] Unable to get fail_on_error from config      
DEBU[0000] Unable to get black_list from config         
DEBU[0000] Unable to get auth_type from config          
DEBU[0000] Unable to get auth_name from config          
DEBU[0000] Unable to get runner from config             
INFO[0000] == REGISTRY CX ==                            
INFO[0000] Name: localregistry                          
INFO[0000] Type: local_openshift                        
INFO[0000] Url:                                         
DEBU[0000] Creating filter for registry: %slocalregistry 
DEBU[0000] whitelist: %v[.*]                            
DEBU[0000] blacklist: %v[]                              
DEBU[0000] Initializing WorkEngine                      
DEBU[0000] Unable to get secrets from config            
DEBU[0000] Creating AnsibleBroker                       
============================================================
==           Starting Ansible Service Broker...           ==
============================================================
INFO[0000] Initiating Recovery Process                  
INFO[0000] Recovery complete                            
INFO[0000] recover called                               
INFO[0000] Broker configured to bootstrap on startup    
INFO[0000] Attempting bootstrap...                      
INFO[0000] AnsibleBroker::Bootstrap 

COLOR output in terminal

logrus-color

RAW log file

Using config file mounted to /etc/ansible-service-broker/config.yaml
============================================================
==           Creating Ansible Service Broker...           ==
============================================================
�[36mINFO�[0m[0000] Initializing clients...                      
�[37mDEBU�[0m[0000] Connecting to Cluster                        
�[36mINFO�[0m[0000] OpenShift version: %vv3.10.0-alpha.0+18dfae9-1209 
�[37mDEBU�[0m[0000] plugin for the network -                     
�[36mINFO�[0m[0000] unable to retrieve the network plugin, defaulting to not joining networks - clusternetworks.network.openshift.io "default" not found 
�[36mINFO�[0m[0000] Kubernetes version: %vv1.10.0+b81c8f8        
�[37mDEBU�[0m[0000] Connecting Dao                               
�[37mDEBU�[0m[0000] Connecting Registry                          
�[37mDEBU�[0m[0000] Unable to get user from config               
�[37mDEBU�[0m[0000] Unable to get pass from config               
�[37mDEBU�[0m[0000] Unable to get images from config             
�[37mDEBU�[0m[0000] Unable to get namespaces from config         
�[37mDEBU�[0m[0000] Unable to get fail_on_error from config      
�[37mDEBU�[0m[0000] Unable to get black_list from config         
�[37mDEBU�[0m[0000] Unable to get auth_type from config          
�[37mDEBU�[0m[0000] Unable to get auth_name from config          
�[37mDEBU�[0m[0000] Unable to get runner from config             
�[36mINFO�[0m[0000] == REGISTRY CX ==                            
�[36mINFO�[0m[0000] Name: dh                                     
�[36mINFO�[0m[0000] Type: dockerhub                              
�[36mINFO�[0m[0000] Url: docker.io                               
�[37mDEBU�[0m[0000] Creating filter for registry: %sdh           
�[37mDEBU�[0m[0000] whitelist: %v[.*-apb$]                       
�[37mDEBU�[0m[0000] blacklist: %v[]                              
�[37mDEBU�[0m[0000] Unable to get url from config                
�[37mDEBU�[0m[0000] Unable to get user from config               
�[37mDEBU�[0m[0000] Unable to get pass from config               
�[37mDEBU�[0m[0000] Unable to get org from config                
�[37mDEBU�[0m[0000] Unable to get tag from config                
�[37mDEBU�[0m[0000] Unable to get images from config             
�[37mDEBU�[0m[0000] Unable to get fail_on_error from config      
�[37mDEBU�[0m[0000] Unable to get black_list from config         
�[37mDEBU�[0m[0000] Unable to get auth_type from config          
�[37mDEBU�[0m[0000] Unable to get auth_name from config          
�[37mDEBU�[0m[0000] Unable to get runner from config             
�[36mINFO�[0m[0000] == REGISTRY CX ==                            
�[36mINFO�[0m[0000] Name: localregistry                          
�[36mINFO�[0m[0000] Type: local_openshift                        
�[36mINFO�[0m[0000] Url:                                         
�[37mDEBU�[0m[0000] Creating filter for registry: %slocalregistry 
�[37mDEBU�[0m[0000] whitelist: %v[.*]                            
�[37mDEBU�[0m[0000] blacklist: %v[]                              
�[37mDEBU�[0m[0000] Initializing WorkEngine                      
�[37mDEBU�[0m[0000] Unable to get secrets from config            
�[37mDEBU�[0m[0000] Creating AnsibleBroker                       
============================================================
==           Starting Ansible Service Broker...           ==
============================================================
�[36mINFO�[0m[0000] Initiating Recovery Process                  
�[36mINFO�[0m[0000] Recovery complete                            
�[36mINFO�[0m[0000] recover called                               
�[36mINFO�[0m[0000] Broker configured to bootstrap on startup    
�[36mINFO�[0m[0000] Attempting bootstrap...                      
�[36mINFO�[0m[0000] AnsibleBroker::Bootstrap

@jmrodri jmrodri added tech-debt 3.11 | release-1.3 Kubernetes 1.11 | Openshift 3.11 | Broker release-1.3 labels May 19, 2018
@jmrodri jmrodri requested a review from mhrivnak May 19, 2018 14:50
@jmrodri
Copy link
Contributor Author

jmrodri commented May 19, 2018

@mhrivnak meant to put you on this as a reviewer

Copy link
Member

@mhrivnak mhrivnak left a comment

Choose a reason for hiding this comment

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

I tested the changes with some basic broker actions, and everything worked as expected. Thanks!

Copy link
Contributor

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

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

🙏 THANK YOU!

Copy link
Contributor

@eriknelson eriknelson left a comment

Choose a reason for hiding this comment

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

Looks good!

@jmrodri jmrodri merged commit ceb7db6 into master May 21, 2018
@jmrodri jmrodri deleted the logrus branch May 21, 2018 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 | release-1.3 Kubernetes 1.11 | Openshift 3.11 | Broker release-1.3 size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tech-debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants