Does anyone know how to view console.log()
from the Xcode simulator using capacitor? I am aware that you can view the system logs via iOS Simulator > Menu Bar > Debug > Open System Log (How can I get the console logs from the iOS Simulator?), but this does not show any of the console.logs when using capacitor to run an ios application.
Asked
Active
Viewed 2,058 times
4

Darrow Hartman
- 4,142
- 2
- 17
- 36
-
open safari go to `devtool` – Najam Us Saqib Aug 09 '21 at 06:37
-
Do you mean the website devtool or an feature in safari called devtool? Because I don't see anything native to safari that's called devtool. There is a tab in safari called "develop", if that's what you mean. Would you mind elaborating @NajamUsSaqib? – Darrow Hartman Aug 10 '21 at 21:00
-
2Check this: https://ionicframework.com/docs/troubleshooting/debugging#ios-and-safari – Najam Us Saqib Aug 11 '21 at 06:25
1 Answers
0
I couldn't get the Ionic instructions to give any output via Safari's dev tools.
However, Capacitor's solution is its built-in Console API https://capacitorjs.com/docs/v2/apis/console
The Console API automatically sends console.debug, console.error, console.info, console.log, console.trace and console.warn calls to the native log system on each respective platform. This enables, for example, console.log calls to be rendered in the Xcode and Android Studio log windows.
I was able to see the logs in Xcode's logging as long as the build isnt broken in some way.

Ben Racicot
- 5,332
- 12
- 66
- 130