How do I undo `-FIRAnalyticsDebugEnabled`?
Asked Answered
C

2

8

I just added FIRAnalyticsDebugEnabled as a launch argument as was suggested in several places:

  1. The Xcode console:

    6.5.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see [https://help.apple.com/xcode/mac/8.0/])
    
  2. The Get Started with Google Analytics for iOS guide:

    enter image description here

  3. Etc.

Once I enabled it, I started seeing output such as:

Event is not subject to real-time event count daily limit. Marking an event as real-time. Event name, parameters: session_start (_s), {
    firebase_debug (_dbg) = 1;
    firebase_event_origin (_o) = auto;
    ga_realtime (_r) = 1;
    session_id (_sid) = 123;
    session_number (_sno) = 2;
}

Now that I know that events are being output properly, I want to disable this as it is spamming the console. However, none of those resources mentioned above talk about how to disable it.

How do I disable it?

I tried removing the launch argument, but the logs still appear.


Note that this is not a duplicate of these similar questions:

Companionship answered 2/8, 2019 at 22:43 Comment(0)
C
15

Many places will tell you to add the launch argument -FIRDebugDisabled but because I didn't have it prior to enabling -FIRAnalyticsDebugEnabled, that seems odd.

It took a while to find, but the page on DebugView has some key information:

To enable Analytics Debug mode on your development device, specify the following command line argument in Xcode :

-FIRDebugEnabled

This behavior persists until you explicitly disable Debug mode by specifying the following command line argument:

-FIRDebugDisabled

The key here is that the "behavior persists." It appears that -FIRAnalyticsDebugEnabled is behaving the exact same way in that it persists: you only need to run it once.

Thus to get back to the state you were in before running with -FIRAnalyticsDebugEnabled:

  1. Run the app once with the -FIRDebugDisabled launch argument.
  2. Remove the launch argument.
Companionship answered 2/8, 2019 at 22:43 Comment(5)
Doesn't it work if you simply delete and reinstall the app?Septicemia
@lulian Onfrei no it won't. That's the problem here. You have to run it again with the disabled argument on. this is why I love XCode and Apple development.Swadeshi
it's documented here firebase.google.com/docs/analytics/debugviewHardiness
For Firebase v8.8.0 I had to set "-noFIRAnalyticsDebugEnabled" flag to turn off debug logs.Czarism
Super-helpful; I would never have found this documentation on my own.Ramiah
T
0

The FirebaseAnalytics framework is using application defaults to persist the setting. This means you can use the defaults command in the terminal to query or change the persisted setting without messing with launch arguments.

# turn it on
defaults write <bundle_identifier> "/google/measurement/debug_mode" 1

# turn it off
defaults write <bundle_identifier> "/google/measurement/debug_mode" 0

# read the current value
defaults read <bundle_identifier> "/google/measurement/debug_mode"

Tested with a MacOS application, but should also apply to iOS.

Taub answered 27/9, 2023 at 18:49 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.