launchdarkly/ios-client-sdk

Logging happening in non debug mode as well

Closed this issue ยท 28 comments

Describe the bug
Logging happening in production non debug mode

To reproduce
Watch the console for automatic logging happening in sdk

Expected behavior
Nothing should be printed

Logs
FlagRequestTracker.trackRequest(flagKey:reportedValue:featureFlag:defaultValue:context:)
etc

Library version
5.7.0

XCode and Swift version
For instance, XCode 15.3, Swift 5.10

Platform the issue occurs on
iPhone, iPad, macOS, tvOS, or watchOS.

Additional context
Switch off complete logging for safety as well.

HI @Ankish, it is intended behavior that logging happens even in a release build. If that is not desirable, you can disable logging on the config using the following.

config.logger = .disabled

Does that address the issue or am I misunderstanding?

I also see this issue, and yes I did try to disable it, but still see the logs @tanderson-ld

@EugeneGordin2303 , thanks for providing additional input. I will be lumping this in with SC-245493 which also relates closely to undesired logs.

@EugeneGordin2303 , what version are using?

@Ankish, your original post says the version you are using is 5.7.0. 5.7.0 does not exist. Is that supposed to be 4.7.0?

@EugeneGordin2303 , what version are using?

@tanderson-ld LaunchDarkly (9.7.2)

@EugeneGordin2303 , are you seeing logs like in the attached when .disabled is provided? Perhaps you are seeing this issue which stems from one of our other packages. I'm also working on fixing that issue.

image

If you are seeing different logs, what logs are you seeing?

I see lots of logs like these.

Screenshot 2024-05-29 at 2 14 33โ€ฏPM Screenshot 2024-05-29 at 2 14 17โ€ฏPM

@tanderson-ld : Sorry its 9.7.0

@Ankish and @EugeneGordin2303, we released 9.8.1 which includes a fix that has the LDEventSource use the same logger as the rest of the iOS SDK. This should resolve issues related to logs such as [LDEventSource] State: raw -> connecting.

I was unable to determine why you are seeing...

FlagRequestTracker.trackRequest(flagKey:reportedValue:featureFlag:defaultValue:context:)
etc

... if you have set the logging to disabled with

config.logger = .disabled

@Ankish , have you had a chance to try the latest version and if so, do you continue to see the issue after disabling loggin?

 var config = LDConfig(mobileKey: LDMobileKey, autoEnvAttributes: .enabled)
            config.logger = .disabled

Showing this:

LDClient.start(serviceFactory:config:context:completion:) LDClient starting
LDClient.observeAll(owner:handler:) owner: SetOnlineOwner
LDClient.observeFlagsUnchanged(owner:handler:) owner: SetOnlineOwner
LDClient.effectiveStreamingMode(config:ldClient:) streaming
LDClient.setOnline true.
LDClient.onFlagSyncComplete(result:) result: flagCollection(LaunchDarkly.FeatureFlagCollection(flags: ["Dremio_Reports_User": LaunchDarkly.FeatureFlag(flagKey: "XX", value: LaunchDarkly.LDValue.bool(false), variation: Optional(1), version: Optional(119), flagVersion: Optional(6), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "movement-assessments": LaunchDarkly.FeatureFlag(flagKey: "movement-assessments", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(16), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "sync-mode-override": LaunchDarkly.FeatureFlag(flagKey: "sync-mode-override", value: LaunchDarkly.LDValue.string("USER"), variation: Optional(2), version: Optional(119), flagVersion: Optional(13), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "reboot-integration": LaunchDarkly.FeatureFlag(flagKey: "reboot-integration", value: LaunchDarkly.LDValue.bool(false), variation: Optional(1), version: Optional(119), flagVersion: Optional(4), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "api-migration-versioning": LaunchDarkly.FeatureFlag(flagKey: "api-migration-versioning", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(87), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "activated": LaunchDarkly.FeatureFlag(flagKey: "activated", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(61), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "mobile-manual-distance-entry": LaunchDarkly.FeatureFlag(flagKey: "mobile-manual-distance-entry", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(3), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "checkerboard-camera-intrinsic-needed": LaunchDarkly.FeatureFlag(flagKey: "checkerboard-camera-intrinsic-needed", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(13), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "test_app_active_user": LaunchDarkly.FeatureFlag(flagKey: "test_app_active_user", value: LaunchDarkly.LDValue.bool(false), variation: Optional(1), version: Optional(119), flagVersion: Optional(64), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "create-initialization-video": LaunchDarkly.FeatureFlag(flagKey: "create-initialization-video", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(5), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "movement-assessment-status": LaunchDarkly.FeatureFlag(flagKey: "movement-assessment-status", value: LaunchDarkly.LDValue.string(""), variation: Optional(3), version: Optional(119), flagVersion: Optional(9), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "checkerboard_calibration": LaunchDarkly.FeatureFlag(flagKey: "checkerboard_calibration", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(11), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "landscape-mode": LaunchDarkly.FeatureFlag(flagKey: "landscape-mode", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(21), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "progression-test": LaunchDarkly.FeatureFlag(flagKey: "progression-test", value: LaunchDarkly.LDValue.array([LaunchDarkly.LDValue.string("jump_progression"), LaunchDarkly.LDValue.string("cmj_progression"), LaunchDarkly.LDValue.string("squat_progression")]), variation: Optional(0), version: Optional(119), flagVersion: Optional(71), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false)]), nil)
LDClient.init(serviceFactory:configuration:startContext:completion:) LDClient started
LDClient.start(serviceFactory:config:context:completion:) All LDClients finished starting
LDClient.stopObserving(owner:) owner: SetOnlineOwner
LDClient.observe(key:owner:handler:) flagKey: activated owner: <Up_Dev.AppDelegate: 0x115bee2a0>
LDClient._identify(context:sheddable:completion:) identify completed with result complete
LDClient.onEventSyncComplete(result:) result: success
LDClient._identify(context:sheddable:completion:) identify completed with result complete
LDClient._identify(context:sheddable:completion:) identify completed with result complete
LDClient.onEventSyncComplete(result:) result: success
LDClient.onEventSyncComplete(result:) result: success
LDClient.onEventSyncComplete(result:) result: success
LDClient.onEventSyncComplete(result:) result: success
LDClient.didEnterBackground()
LDClient.effectiveStreamingMode(config:ldClient:) polling LDClient is in background mode with background updates disabled.
LDClient.didCloseEventSource()
LDClient.willEnterForeground()
LDClient.effectiveStreamingMode(config:ldClient:) streaming
LDClient.onFlagSyncComplete(result:) result: flagCollection(LaunchDarkly.FeatureFlagCollection(flags: ["checkerboard_calibration": LaunchDarkly.FeatureFlag(flagKey: "checkerboard_calibration", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(11), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "checkerboard-camera-intrinsic-needed": LaunchDarkly.FeatureFlag(flagKey: "checkerboard-camera-intrinsic-needed", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(13), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "Dremio_Reports_User": LaunchDarkly.FeatureFlag(flagKey: "Dremio_Reports_User", value: LaunchDarkly.LDValue.bool(false), variation: Optional(1), version: Optional(119), flagVersion: Optional(6), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "create-initialization-video": LaunchDarkly.FeatureFlag(flagKey: "create-initialization-video", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(5), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "landscape-mode": LaunchDarkly.FeatureFlag(flagKey: "landscape-mode", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(21), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "movement-assessments": LaunchDarkly.FeatureFlag(flagKey: "movement-assessments", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(16), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "api-migration-versioning": LaunchDarkly.FeatureFlag(flagKey: "api-migration-versioning", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(87), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "activated": LaunchDarkly.FeatureFlag(flagKey: "activated", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(61), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "progression-test": LaunchDarkly.FeatureFlag(flagKey: "progression-test", value: LaunchDarkly.LDValue.array([LaunchDarkly.LDValue.string("jump_progrn"), LaunchDarkly.LDValue.string("cmj_progression"), LaunchDarkly.LDValue.string("squat_prn")]), variation: Optional(0), version: Optional(119), flagVersion: Optional(71), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "reboot-integration": LaunchDarkly.FeatureFlag(flagKey: "reboot-integration", value: LaunchDarkly.LDValue.bool(false), variation: Optional(1), version: Optional(119), flagVersion: Optional(4), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "mobile-manual-distance-entry": LaunchDarkly.FeatureFlag(flagKey: "mobile-manual-distance-entry", value: LaunchDarkly.LDValue.bool(true), variation: Optional(0), version: Optional(119), flagVersion: Optional(3), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "movement-assessment-status": LaunchDarkly.FeatureFlag(flagKey: "movement-assessment-status", value: LaunchDarkly.LDValue.string(""), variation: Optional(3), version: Optional(119), flagVersion: Optional(9), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "sync-mode-override": LaunchDarkly.FeatureFlag(flagKey: "sync-mode-override", value: LaunchDarkly.LDValue.string("USER"), variation: Optional(2), version: Optional(119), flagVersion: Optional(13), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false), "test_app_active_user": LaunchDarkly.FeatureFlag(flagKey: "test_app_active_user", value: LaunchDarkly.LDValue.bool(false), variation: Optional(1), version: Optional(119), flagVersion: Optional(64), trackEvents: false, debugEventsUntilDate: nil, reason: nil, trackReason: false)]), nil)
LDClient.onEventSyncComplete(result:) result: success

We really do not want any logging , if its turned off It kind of violates the security to leak important keys.
This is with 9.7.2

@Ankish, we do not see logs when we use .disabled and other customers in other issues have confirmed that using .disabled turns off logging for them. Can you double check through some other modification that the code with .disabled is being installed? Which platform was the output from your most recent comment?

@tanderson-ld you said 9.8.1 but I see that pod does not have it. I tried to install it using pods but getting this:
CocoaPods could not find compatible versions for pod "LaunchDarkly"

When I'm not using version specifier it just installs LaunchDarkly (9.7.2)

When I run pod search LaunchDarkly

I get:

-> LaunchDarkly (9.8.2)
   iOS SDK for LaunchDarkly
   pod 'LaunchDarkly', '~> 9.8.2'
   - Homepage: https://github.com/launchdarkly/ios-client-sdk
   - Source:   https://github.com/launchdarkly/ios-client-sdk.git
   - Versions: 9.8.2, 9.8.1, 9.8.0, 9.7.2, 9.7.1, 9.7.0, 9.6.2, 9.6.1, 9.6.0, 9.5.1, 9.5.0, 9.4.1, 9.4.0, 9.3.0, 9.2.1, 9.2.0, 9.1.1,
   9.1.0, 9.0.2, 9.0.1, 9.0.0, 8.4.2, 8.4.1, 8.4.0, 8.3.1, 8.3.0, 8.2.0, 8.1.0, 8.0.1, 8.0.0, 7.1.0, 7.0.0, 6.2.0, 6.1.0, 6.0.0, 5.4.5,
   5.4.4, 5.4.3, 5.4.2, 5.4.1, 5.4.0, 5.3.2, 5.3.1, 5.3.0, 5.2.0, 5.1.0, 5.0.1, 4.7.0, 4.6.0, 4.5.0, 4.4.1, 4.4.0, 4.3.2, 4.3.1, 4.3.0,
   4.2.1, 4.2.0, 4.1.2, 4.1.1, 4.1.0, 4.0.0, 3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0.0, 2.14.4, 2.14.3, 2.14.2, 2.14.1, 2.14.0, 2.13.9, 2.13.8,
   2.13.7, 2.13.6, 2.13.5, 2.13.4, 2.13.3, 2.13.2, 2.13.1, 2.13.0, 2.12.1, 2.12.0, 2.11.1, 2.11.0, 2.10.1, 2.10.0, 2.9.1, 2.9.0, 2.8.0,
   2.7.0, 2.6.1, 2.6.0, 2.5.1, 2.5.0, 2.4.2, 2.4.1, 2.4.0, 2.3.3, 2.3.2, 2.3.1, 2.3.0, 2.2.0, 2.1.3, 2.1.2, 2.1.1, 2.1.0, 2.0.3, 2.0,
   1.1.0, 1.0.3, 1.0.2, 1.0.1, 1.0.0, 0.4.4, 0.4.3, 0.4.2, 0.4.2-beta, 0.4.1-beta, 0.4.0-beta, 0.3.0-beta, 0.2.2-beta, 0.2.0-beta,
   0.1.0-beta [trunk repo]
   - Subspecs:
     - LaunchDarkly/Core (9.8.2)

If you run pod repo update perhaps that fixes it?

yeah, I tried search too, it just errored out :)))

-> LaunchDarkly (9.7.2)
iOS SDK for LaunchDarkly
pod 'LaunchDarkly', '~> 9.7.2'

  • Homepage: https://github.com/launchdarkly/ios-client-sdk
  • Source: https://github.com/launchdarkly/ios-client-sdk.git
  • Versions: 9.7.2, 9.7.1, 9.7.0, 9.6.2, 9.6.1, 9.6.0, 9.5.1, 9.5.0, 9.4.1, 9.4.0, 9.3.0,
    9.2.1, 9.2.0, 9.1.1, 9.1.0, 9.0.2, 9.0.1, 9.0.0, 8.4.2, 8.4.1, 8.4.0, 8.3.1, 8.3.0,
    8.2.0, 8.1.0, 8.0.1, 8.0.0, 7.1.0, 7.0.0, 6.2.0, 6.1.0, 6.0.0, 5.4.5, 5.4.4, 5.4.3,
    5.4.2, 5.4.1, 5.4.0, 5.3.2, 5.3.1, 5.3.0, 5.2.0, 5.1.0, 5.0.1, 4.7.0, 4.6.0, 4.5.0,
    4.4.1, 4.4.0, 4.3.2, 4.3.1, 4.3.0, 4.2.1, 4.2.0, 4.1.2, 4.1.1, 4.1.0, 4.0.0, 3.0.4,
    3.0.3, 3.0.2, 3.0.1, 3.0.0, 2.14.4, 2.14.3, 2.14.2, 2.14.1, 2.14.0, 2.13.9, 2.13.8,
    2.13.7, 2.13.6, 2.13.5, 2.13.4, 2.13.3, 2.13.2, 2.13.1, 2.13.0, 2.12.1, 2.12.0, 2.11.1,
    2.11.0, 2.10.1, 2.10.0, 2.9.1, 2.9.0, 2.8.0, 2.7.0, 2.6.1, 2.6.0, 2.5.1, 2.5.0, 2.4.2,
    2.4.1, 2.4.0, 2.3.3, 2.3.2, 2.3.1, 2.3.0, 2.2.0, 2.1.3, 2.1.2, 2.1.1, 2.1.0, 2.0.3, 2.0,
    1.1.0, 1.0.3, 1.0.2, 1.0.1, 1.0.0, 0.4.4, 0.4.3, 0.4.2, 0.4.2-beta, 0.4.1-beta,
    0.4.0-beta, 0.3.0-beta, 0.2.2-beta, 0.2.0-beta, 0.1.0-beta [trunk repo]
  • Subspecs:
    • LaunchDarkly/Core (9.7.2)

-> ConfigCat (11.1.0)
ConfigCat Swift SDK
pod 'ConfigCat', '~> 11.1.0'

  • Homepage: https://github.com/configcat/swift-sdk
  • Source: https://github.com/configcat/swift-sdk.git
  • Versions: 11.1.0, 11.0.3, 11.0.2, 11.0.1, 11.0.0, 10.0.0, 9.4.0, 9.3.0, 9.2.4, 9.2.3,
    9.2.2, 9.2.1, 9.2.0, 9.1.2, 9.1.1, 9.1.0, 9.0.1, 9.0.0, 8.0.1, 8.0.0, 7.2.1, 7.2.0,
    7.1.0, 7.0.0, 6.0.1, 6.0.0, 5.1.0, 5.0.1, 5.0.0, 4.0.0, 3.1.0, 3.0.0, 2.4.2, 2.4.1,
    2.4.0, 2.3.1, 2.3.0, 2.2.0, 2.1.3, 2.1.2, 2.1.1, 2.1.0, 2.0.0, 1.0.3, 1.0.2, 1.0.1
    [trunk repo]

-> DarklyEventSource (4.1.1)
HTML5 Server-Sent Events in your Cocoa app.
pod 'DarklyEventSource', '~> 4.1.1'

-> LDSwiftEventSource (3.2.0)
Swift EventSource library
pod 'LDSwiftEventSource', '~> 3.2.0'

Multiple third party sites see 9.8.2 including this one

what is the min iOS version supported ?

12, I think, OK...well...no idea lol

got it...good old pod cache duh

Did it fix the logging issue @EugeneGordin2303 ?

Yes! Great! Thank you

@Ankish, we are closing this issue since two other customers have confirmed this latest version does disable logging when .disabled is used. Please re-open this if you find the latest version doesn't fix your issue.

@tanderson-ld : I updated to 9.8.2 I still see logging happens, even if disabled. I even removed complete cache and installed.

@Ankish something else must be at work here if you are still seeing logging from our SDK.

Can you please provide the exact logs you are seeing once again?

I would also like to have you try reproducing this problem under a much simpler app. Please apply the below patch to the Hello Example app. You can apply it with patch -p1 < my.patch

Once you have done that, can you confirm if you are seeing any logging in that situation?

diff --git a/Podfile b/Podfile
index 33f416b..595d596 100644
--- a/Podfile
+++ b/Podfile
@@ -3,5 +3,5 @@ platform :ios, '12.0'
 use_frameworks!
 
 target 'hello-ios-swift' do
-    pod 'LaunchDarkly', '>= 9.6.0'
+    pod 'LaunchDarkly', '9.8.1'
 end
diff --git a/hello-ios-swift/AppDelegate.swift b/hello-ios-swift/AppDelegate.swift
index d7efb0a..f14162a 100755
--- a/hello-ios-swift/AppDelegate.swift
+++ b/hello-ios-swift/AppDelegate.swift
@@ -24,7 +24,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         guard case .success(let context) = contextBuilder.build()
         else { return }
 
-        let config = LDConfig(mobileKey: sdkKey, autoEnvAttributes: .enabled)
+        var config = LDConfig(mobileKey: sdkKey, autoEnvAttributes: .enabled)
+        config.logger = .disabled
+
         LDClient.start(config: config, context: context, startWaitSeconds: 30)
     }
 }

This issue is marked as stale because it has been open for 30 days without activity. Remove the stale label or comment, or this will be closed in 7 days.