Repository: ray-project/ray

Issue:
Excess INFO messages to console in latest build
<!--Please include [tune], [rllib], [autoscaler] etc. in the issue title if relevant-->

### What is the problem?

Master build logs this to console on ray init:
```
>>> (pid=raylet) WARNING: Logging before InitGoogleLogging() is written to STDERR
(pid=raylet) I0518 14:41:09.151492  3131 global_state_accessor.cc:25] Redis server address = 192.168.5.121:6379, is test flag = 0
(pid=raylet) I0518 14:41:09.166244  3131 redis_client.cc:141] RedisClient connected.
(pid=raylet) WARNING: Logging before InitGoogleLogging() is written to STDERR
(pid=raylet) I0518 14:41:09.168131  3135 global_state_accessor.cc:25] Redis server address = 192.168.5.121:6379, is test flag = 0
(pid=raylet) I0518 14:41:09.174638  3131 redis_gcs_client.cc:88] RedisGcsClient Connected.
(pid=raylet) I0518 14:41:09.175307  3131 service_based_gcs_client.cc:66] ServiceBasedGcsClient Connected.
(pid=raylet) WARNING: Logging before InitGoogleLogging() is written to STDERR
(pid=raylet) I0518 14:41:09.177665  3132 global_state_accessor.cc:25] Redis server address = 192.168.5.121:6379, is test flag = 0
(pid=raylet) I0518 14:41:09.178391  3135 redis_client.cc:141] RedisClient connected.
(pid=raylet) I0518 14:41:09.181085  3132 redis_client.cc:141] RedisClient connected.
(pid=raylet) I0518 14:41:09.187088  3135 redis_gcs_client.cc:88] RedisGcsClient Connected.
(pid=raylet) I0518 14:41:09.187737  3135 service_based_gcs_client.cc:66] ServiceBasedGcsClient Connected.
(pid=raylet) I0518 14:41:09.194645  3132 redis_gcs_client.cc:88] RedisGcsClient Connected.
(pid=raylet) I0518 14:41:09.195237  3132 service_based_gcs_client.cc:66] ServiceBasedGcsClient Connected.
(pid=raylet) WARNING: Logging before InitGoogleLogging() is written to STDERR
(pid=raylet) I0518 14:41:09.226564  3133 global_state_accessor.cc:25] Redis server address = 192.168.5.121:6379, is test flag = 0
(pid=raylet) I0518 14:41:09.230108  3133 redis_client.cc:141] RedisClient connected.
(pid=raylet) I0518 14:41:09.238509  3133 redis_gcs_client.cc:88] RedisGcsClient Connected.
(pid=raylet) I0518 14:41:09.239135  3133 service_based_gcs_client.cc:66] ServiceBasedGcsClient Connected.
(pid=raylet) WARNING: Logging before InitGoogleLogging() is written to STDERR
(pid=raylet) I0518 14:41:09.279531  3136 global_state_accessor.cc:25] Redis server address = 192.168.5.121:6379, is test flag = 0
(pid=raylet) I0518 14:41:09.280068  3136 redis_client.cc:141] RedisClient connected.
(pid=raylet) I0518 14:41:09.288298  3136 redis_gcs_client.cc:88] RedisGcsClient Connected.
(pid=raylet) I0518 14:41:09.288733  3136 service_based_gcs_client.cc:66] ServiceBasedGcsClient Connected.
(pid=raylet) WARNING: Logging before InitGoogleLogging() is written to STDERR
(pid=raylet) I0518 14:41:09.300333  3130 global_state_accessor.cc:25] Redis server address = 192.168.5.121:6379, is test flag = 0
(pid=raylet) I0518 14:41:09.301705  3130 redis_client.cc:141] RedisClient connected.
(pid=raylet) I0518 14:41:09.309738  3130 redis_gcs_client.cc:88] RedisGcsClient Connected.
(pid=raylet) I0518 14:41:09.310228  3130 service_based_gcs_client.cc:66] ServiceBasedGcsClient Connected.
(pid=raylet) WARNING: Logging before InitGoogleLogging() is written to STDERR
(pid=raylet) I0518 14:41:09.316042  3134 global_state_accessor.cc:25] Redis server address = 192.168.5.121:6379, is test flag = 0
(pid=raylet) I0518 14:41:09.317946  3134 redis_client.cc:141] RedisClient connected.
(pid=raylet) I0518 14:41:09.326037  3134 redis_gcs_client.cc:88] RedisGcsClient Connected.
(pid=raylet) I0518 14:41:09.326454  3134 service_based_gcs_client.cc:66] ServiceBasedGcsClient Connected.
(pid=raylet) WARNING: Logging before InitGoogleLogging() is written to STDERR
(pid=raylet) I0518 14:41:09.357240  3137 global_state_accessor.cc:25] Redis server address = 192.168.5.121:6379, is test flag = 0
(pid=raylet) I0518 14:41:09.357900  3137 redis_client.cc:141] RedisClient connected.
(pid=raylet) I0518 14:41:09.366128  3137 redis_gcs_client.cc:88] RedisGcsClient Connected.
(pid=raylet) I0518 14:41:09.366888  3137 service_based_gcs_client.cc:66] ServiceBasedGcsClient Connected.
```


Discussion:
@ffbin is this related to your recent change?
@ericl This log  is related to this PR. https://github.com/ray-project/ray/pull/8401 I will take a look, thanks.

Resolving patch:
diff --git a/python/ray/worker.py b/python/ray/worker.py
--- a/python/ray/worker.py
+++ b/python/ray/worker.py
@@ -1195,10 +1195,6 @@ def connect(node,
 
     worker.lock = threading.RLock()
 
-    # Create an object for interfacing with the global state.
-    ray.state.state._initialize_global_state(
-        node.redis_address, redis_password=node.redis_password)
-
     driver_name = ""
     log_stdout_file_name = ""
     log_stderr_file_name = ""
@@ -1269,6 +1265,12 @@ def connect(node,
         log_stderr_file_name,
     )
 
+    # Create an object for interfacing with the global state.
+    # Note, global state should be intialized after `CoreWorker`, because it will
+    # use glog, which is intialized in `CoreWorker`.
+    ray.state.state._initialize_global_state(
+        node.redis_address, redis_password=node.redis_password)
+
     if driver_object_store_memory is not None:
         worker.core_worker.set_object_store_client_options(
             "ray_driver_{}".format(os.getpid()), driver_object_store_memory)


Test patch: