Completely disable Firebase/Analytics to stop console spam on app startup

JosephH picture JosephH · Jun 7, 2017 · Viewed 11.4k times · Source

I've installed Google/SignIn cocoapod into my application (which I need to support GoogleDrive), but it depends on Google/Core which depends on FirebaseAnalytics. I don't want or need FirebaseAnalytics.

FirebaseAnalytics spams the developer console with 8 lines of output when our app starts:

2017-06-07 18:07:19.612994+0100 son[2909:877661] [Firebase/Analytics][I-ACS005000] The AdSupport Framework is not currently linked. Some features will not function properly. Learn more at http://gooX.gl/9vSsPb
2017-06-07 18:07:19.613 son[2909] <Warning> [Firebase/Analytics][I-ACS005000] The AdSupport Framework is not currently linked. Some features will not function properly. Learn more at http://gooX.gl/9vSsPb
2017-06-07 18:07:19.613896+0100 son[2909:877661] [Firebase/Analytics][I-ACS023007] Firebase Analytics v.3900000 started
2017-06-07 18:07:19.614 son[2909] <Notice> [Firebase/Analytics][I-ACS023007] Firebase Analytics v.3900000 started
2017-06-07 18:07:19.614525+0100 son[2909:877661] [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://gooX.gl/RfcP7r)
2017-06-07 18:07:19.614 son[2909] <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://gooX.gl/RfcP7r)
2017-06-07 18:07:19.622560+0100 son[2909:877662] [Firebase/Analytics][I-ACS023013] Firebase Analytics disabled
2017-06-07 18:07:19.623 son[2909] <Notice> [Firebase/Analytics][I-ACS023013] Firebase Analytics disabled

(I had to add X to the URLs in the above output to get past stackoverflow's URL shortener blocker.)

I tried setting FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED to YES in my Info.plist, that removed 2 lines, but added another 2 lines to tell me that Analytics is disabled (FFS!).

This spammed output makes it difficult for our developers to see any console output that is actually important. How can I disable it?

(Failing that, a suggestion on how to get it outputting each line only once would be really welcome.)

Answer

Paul Beusterien picture Paul Beusterien · Jun 8, 2017

You can find this buried in the output:

<Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging
 set the following application argument: -FIRAnalyticsDebugEnabled

Disabling is the opposite - set the argument: -noFIRAnalyticsDebugEnabled:

enter image description here

Additionally, you can control the default Firebase logging level with the setLoggerLevel method in FIRConfiguration. For example to disable all Firebase logging:

  [[FIRConfiguration sharedInstance] setLoggerLevel:FIRLoggerLevelMin];
  [FIRApp configure];

or in Swift:

FirebaseConfiguration.shared.setLoggerLevel(FirebaseLoggerLevel.min)
FirebaseApp.configure()

More details in the FIRLogger implementation here