vlib: init logging eearlier

Type: improvement
Change-Id: I2eb5543aa470094d4c5ad420a2fcc9873b7808e1
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vlib/log.c b/src/vlib/log.c
index 07561d9..a7791e4 100644
--- a/src/vlib/log.c
+++ b/src/vlib/log.c
@@ -366,8 +366,8 @@
   return format (s, "%s", t);
 }
 
-static clib_error_t *
-vlib_log_init (vlib_main_t * vm)
+clib_error_t *
+vlib_log_init (vlib_main_t *vm)
 {
   vlib_log_main_t *lm = &log_main;
   vlib_log_class_registration_t *r = lm->registrations;
@@ -396,9 +396,6 @@
   return 0;
 }
 
-VLIB_INIT_FUNCTION (vlib_log_init);
-
-
 static clib_error_t *
 show_log (vlib_main_t * vm,
 	  unformat_input_t * input, vlib_cli_command_t * cmd)
diff --git a/src/vlib/log.h b/src/vlib/log.h
index c3ebb81..0ded4a8 100644
--- a/src/vlib/log.h
+++ b/src/vlib/log.h
@@ -117,6 +117,7 @@
 
 extern vlib_log_main_t log_main;
 
+clib_error_t *vlib_log_init (struct vlib_main_t *vm);
 vlib_log_class_t vlib_log_register_class (char *vlass, char *subclass);
 vlib_log_class_t
 vlib_log_register_class_rate_limit (char *class, char *subclass,
diff --git a/src/vlib/main.c b/src/vlib/main.c
index 6d241bd..874f6a1 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -1887,6 +1887,12 @@
       goto done;
     }
 
+  if ((error = vlib_log_init (vm)))
+    {
+      clib_error_report (error);
+      goto done;
+    }
+
   if ((error = vlib_stats_init (vm)))
     {
       clib_error_report (error);