calabash / calabash-ios

Calabash for iOS
Other
1.81k stars 369 forks source link

Calabash breaks logging in Xcode #1386

Closed ryanmeisters closed 6 years ago

ryanmeisters commented 6 years ago

We are currently using calabash-its v0.20.4 installed via Cocoapods and all is well. When I update to the latest version (0.21.5) all logging is broken. There are two logs from calabash, but nothing else (see screenshot below). Even adding a print statement at the beginning of application(didFinishLaunchingWithOptions:) doesn't work.

Any insights?

We have temporarily fixed by removing calabash-ios from our debug config, so it is only linked for our alpha builds. pod 'Calabash', '~> 0.21.5', :configurations => ['Alpha']

screen shot 2018-07-09 at 11 55 16 am

JoeSSS commented 6 years ago

This has changed in Xcode9. You can redirect logs to file (e.g. https://stackoverflow.com/questions/34026018/swift-redirect-console-log-to-document-folder)

ryanmeisters commented 6 years ago

@JoeSSS I'm not sure I follow. Is calabash-ios doing some internal log routing?

jmoody commented 6 years ago

@ryanmeisters Apple changed the entire logging system so you no longer see as many logs in Xcode. Calabash tries to reroute the logs so they appear as they used to appear. You can find all logs in the Console app.

ryanmeisters commented 6 years ago

I see. That seems like an odd side effect for a dependency. Is there a way to disable? Happy to make a PR if someone can point me in the right direction

jmoody commented 6 years ago

Remove code in these two places:

odd side effect

Perhaps. On the other hand, Apple's logging changes have broken some user's workflows.

With that said, removing this behavior is probably the right decision. Apps can opt-in by adding the redirect code.

ryanmeisters commented 6 years ago

Ah thanks for that. I was thinking we could just add a preprocessor macro, something like CALABASH_DISABLE_LOG_REDIRECT. I'm a bit confused now though since those two links are in other repositories. How does calabash-ios interact with calabash-ios-server and the main calabash?

jmoody commented 6 years ago

Calabash iOS Server (AKA LPServer: less painful server) is the embedded server that is added to your application when you link the calabash.framework. This server provides the query engine.

The calabash-ios (AKA calabash-cucumber) gem is an (http) client for the Calabash iOS Server.

DeviceAgent.iOS is an XCUITest Runner (a .app) that launches your application, performs gestures and other test automation tasks.

run-loop is an (http) client for DeviceAgent.iOS.

When calabash-ios wants to perform a gesture, it asks run-loop to ask DeviceAgent.iOS to perform the gesture.

jmoody commented 6 years ago

@ryanmeisters Don't be afraid to just delete the code blocks and callers then submit a pull request.

AlexWellsHS commented 6 years ago

@jmoody the code blocks you referenced seem to only run if the app is running on a simulator. however, were experiencing this issue when running on attached devices as well. is this expected?

JoeSSS commented 6 years ago

I think that it is expected as when we get simulator log, we look into internal Simulator files and it is not possible in the real device case.

jmoody commented 6 years ago

only if the app is running on the simulator

Not expected. Probably not caused by Calabash. I believe you have to look in the Console.app now.