launchdarkly / ios-client-sdk

LaunchDarkly Client-side SDK for iOS (Swift and Obj-C)
https://docs.launchdarkly.com/sdk/client-side/ios
Other
68 stars 82 forks source link

Logging happening in non debug mode as well #388

Open Ankish opened 1 month ago

Ankish commented 1 month ago

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.

tanderson-ld commented 1 month ago

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?

EugeneGordin2303 commented 1 month ago

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

tanderson-ld commented 1 month ago

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

tanderson-ld commented 1 month ago

@EugeneGordin2303 , what version are using?

tanderson-ld commented 1 month ago

@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 commented 1 month ago

@EugeneGordin2303 , what version are using?

@tanderson-ld LaunchDarkly (9.7.2)

tanderson-ld commented 1 month ago

@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?

EugeneGordin2303 commented 1 month ago

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
Ankish commented 1 month ago

@tanderson-ld : Sorry its 9.7.0

tanderson-ld commented 4 weeks ago

@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
tanderson-ld commented 3 weeks ago

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

Ankish commented 2 weeks ago
 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

tanderson-ld commented 2 weeks ago

@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?

EugeneGordin2303 commented 1 week ago

@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)

tanderson-ld commented 1 week ago

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)
tanderson-ld commented 1 week ago

If you run pod repo update perhaps that fixes it?

EugeneGordin2303 commented 1 week ago

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

EugeneGordin2303 commented 1 week ago

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

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

-> 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'

tanderson-ld commented 1 week ago

Multiple third party sites see 9.8.2 including this one

EugeneGordin2303 commented 1 week ago

what is the min iOS version supported ?

EugeneGordin2303 commented 1 week ago

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

EugeneGordin2303 commented 1 week ago

got it...good old pod cache duh

tanderson-ld commented 1 week ago

Did it fix the logging issue @EugeneGordin2303 ?

EugeneGordin2303 commented 1 week ago

Yes! Great! Thank you

tanderson-ld commented 1 week ago

@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.

Ankish commented 4 days ago

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