launchdarkly / ios-client-sdk

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

Xcode simulator producing endless LD log noise "Connection unexpectedly closed" #321

Closed MeteC closed 7 months ago

MeteC commented 9 months ago

Is this a support request? It's related to framework logging in Xcode.

Describe the bug I wonder if this points to a bug or not, but it's certainly a developer tooling issue - every 60 seconds there's a repeated stream of 6 log entries from LaunchDarkly context, like so:

Connection unexpectedly closed.
State: open -> closed
Waiting 0.687 seconds before reconnecting...
Starting EventSource client
Initial reply received
State: closed -> open

This doesn't happen on the physical device, but is seriously annoying when trying to analyse log traces when using the simulator.

To reproduce Start a LaunchDarkly client when running on simulator. Watch logs for several minutes.

Expected behavior The same behaviour as the physical device? I didn't expect to muddy up my logs by installing a LaunchDarkly client.

Logs See above

SDK version 9.2.1

Language version, developer tools Xcode 15.1 iPad (10th generation) (17.2) simulator

OS/platform macOS Sonoma 14.1.1

Thank you!

tanderson-ld commented 9 months ago

Hi @MeteC, thank you for reporting this. We'll investigate and get back to you with what we find.

tanderson-ld commented 9 months ago

Hi @MeteC , I'm not able to reproduce this issue on my machine. I tested on an iPhone 14 simulator and iPad 10th generation simulator and did not observe this happening.

Could you provide a snippet of your config creation?

Do you have any network connectivity issues, firewalls, VPN set up?

Are you backgrounding/foregrounding the app when you see this issue?

Do you ever see a Waiting 0.687 seconds before reconnecting... time greater than 2 seconds when this issue is occurring?

Thank you!

MeteC commented 9 months ago

Hi @tanderson-ld , thanks for looking into this.

I'm on Christmas holidays at the moment, will get back to you asap in the new year!

MeteC commented 8 months ago

Hello!

Sorry about this - I've returned to work and have had my laptop reformatted and everything set up from scratch thanks to some corporate security scale-ups. The upshot of this is I now cannot replicate my own bug, and everything seems to be working perfectly well.

If this issue ever repeats on me I'll get in touch, but sadly I can't help reproduce it now, as the machine which was producing the problem has been sent to oblivion 😅. So it may be preferable to close this issue for now!

pikaboo commented 8 months ago

You need to make the log configurable - You have a logger that I can't get to, even though the class is public. In which you define the logging situation. You have a setting "noLogging" but it doesnt actually turn off the logging, it just removes the prefix. please fix this as soon as possible, it is impossible to debug the library usage, because of this

keelerm84 commented 8 months ago

@pikaboo I agree logging could use some work.

If we relied on os_log would that be sufficient for your needs?

keelerm84 commented 7 months ago

We released v9.4.0 which updates our logging usage to os_log. All SDK log messages will be logged under subsystem "com.launchdarkly", category "ios-client-sdk".

You can provide your own logger instance by setting the LDConfig.logger property, including passing .disabled to turn off logging entirely.