[SEBA-853] Collection BBR Logs
Change-Id: I25ae10408cc64db2591a8431e82f065e72ef55af
diff --git a/cmd/bbr/bbr.go b/cmd/bbr/bbr.go
index 30c3c71..a98decd 100644
--- a/cmd/bbr/bbr.go
+++ b/cmd/bbr/bbr.go
@@ -37,6 +37,15 @@
common.SetLogLevel(log.StandardLogger(), options.LogLevel, options.LogCaller)
+ if options.LogFile != "" {
+ file, err := os.OpenFile(options.LogFile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
+ if err == nil {
+ log.StandardLogger().Out = file
+ } else {
+ log.Fatal("Failed to log to file, using default stderr")
+ }
+ }
+
if *options.ProfileCpu != "" {
// start profiling
log.Infof("Creating profile file at: %s", *options.ProfileCpu)