neutronclient shows low-level logs in console screen
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-neutronclient |
Fix Released
|
Medium
|
Feng Xi Yan |
Bug Description
Problem summary:
All neutron command will show 1 ˜3 lines of "Starting new HTTP connection (1): <ip of the controller>", I think these sentence are no impact to the command result, and useless to customers,
And other component do not show such sentence, like nova, glance, only neutron command will display these sentence, all component should keep the same format for their command, these sentence are easy to make customers think there is error with neutron.
So neutron command should not display these sentence.
Test Steps:
1. install neutron
2. Run neutron command
[root@cmwo81 home]# neutron net-create net_local --provider:
Starting new HTTP connection (1): 10.104.0.81
Starting new HTTP connection (1): 10.104.0.81
Created a new network:
+------
| Field | Value |
+------
| admin_state_up | True |
| id | 44f104cb-
| name | net_local |
| provider:
| provider:
| provider:
| shared | False |
| status | ACTIVE |
| subnets | |
| tenant_id | 1227a7d1ab094fb
+------
[root@cmwo81 home]# neutron subnet-create net_local 10.0.1.0/24 --name sub_netlocal --dns-nameserver 10.0.1.1
Starting new HTTP connection (1): 10.104.0.81
Starting new HTTP connection (1): 10.104.0.81
Starting new HTTP connection (1): 10.104.0.81
Created a new subnet:
+------
| Field | Value |
+------
| allocation_pools | {"start": "10.0.1.2", "end": "10.0.1.254"} |
| cidr | 10.0.1.0/24 |
| dns_nameservers | 10.0.1.1 |
| enable_dhcp | True |
| gateway_ip | 10.0.1.1 |
| host_routes | |
| id | ebf6d6c5-
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | sub_netlocal |
| network_id | 44f104cb-
| tenant_id | 1227a7d1ab094fb
+------
[root@cmwo81 ˜]# neutron net-list
Starting new HTTP connection (1): 10.104.0.81
Starting new HTTP connection (1): 10.104.0.81
Starting new HTTP connection (1): 10.104.0.81
+------
| id | name | subnets |
+------
| 44f104cb-
+------
Expected result:
neutron command does not show "Starting new HTTP connection (1): 10.104.0.81". for example, the expected result of neutron net-list should be as below:
[root@cmwo81 ˜]# neutron net-list
+------
| id | name | subnets |
+------
| 44f104cb-
+------
Changed in python-neutronclient: | |
assignee: | nobody → Feng Xi Yan (yanfengxi) |
status: | New → In Progress |
Changed in python-neutronclient: | |
importance: | Undecided → Medium |
milestone: | none → 2.3.7 |
Changed in python-neutronclient: | |
milestone: | 2.3.7 → 2.3.8 |
Changed in python-neutronclient: | |
status: | Fix Committed → Fix Released |
vim neutronclient/ shell.py
def configure_ logging( self): getLogger( '')
"""Create logging handlers for any log output."""
root_logger = logging.
# Set up logging to a file
root_logger. setLevel( logging. DEBUG)
# Send higher-level messages to the console via stderr StreamHandler( self.stderr)
console_ level = {self.WARNING_ LEVEL: logging.WARNING,
self. INFO_LEVEL: logging.INFO,
self. DEBUG_LEVEL: logging.DEBUG,
}.get( self.options. verbose_ level, logging.DEBUG)
console. setLevel( console_ level)
formatter = logging. Formatter( self.DEBUG_ MESSAGE_ FORMAT)
formatter = logging. Formatter( self.CONSOLE_ MESSAGE_ FORMAT)
console. setFormatter( formatter)
root_logger. addHandler( console)
console = logging.
if logging.DEBUG == console_level:
else:
return
As the code says, there is a console stream to display higher-level messages.
But the log "Starting new HTTP connection (1): 10.104.0.81" is a low-level(INFO) log of urllib3
def _new_conn(self): `httplib. HTTPConnection` .
self.num_ connections += 1
log.info( "Starting new HTTP connection (%d): %s" %
(self. num_connections , self.host)) host=self. host, port=self.port)
"""
Return a fresh :class:
"""
return HTTPConnection(
We should set the log_level of the console stream to WARNING to avoid displaying low level logs.
If we want to use --debug to display detailed messages, we should set the log level of the console stream to DEBUG.