There exists a very useful way to debug requests in 100.x, this:
let config = AGSRequestConfiguration.global()
config.debugLogFileURL = URL(fileURLWithPath: "/tmp/arcgis.md")
config.debugLogRequests = true
config.debugLogIncludeRequestHeaders = true
config.debugLogResponses = true
config.debugLogIncludeResponseHeaders = true
config.debugLogResponseTrimThreshold = 500
config.debugLogIgnoreTiledLayerRequests = trueIs there an equivalent version in 200.x? I checked the documentation but haven't found anything similar.
Solved! Go to Solution.
Hi @zdtorok,
Please use ConsoleNetworkLogger in 200.x for request logging. You can use following code at the start of the application.
let logger = ConsoleNetworkLogger(requestOptions: [.method, .body, .headers], responseOptions: [.data, .headers])
logger.startLogging()
Also, you can use the NetworkLogger protocol to build your own custom network logger.
Hope this helps!
Regards,
Nimesh
Hi @zdtorok,
Please use ConsoleNetworkLogger in 200.x for request logging. You can use following code at the start of the application.
let logger = ConsoleNetworkLogger(requestOptions: [.method, .body, .headers], responseOptions: [.data, .headers])
logger.startLogging()
Also, you can use the NetworkLogger protocol to build your own custom network logger.
Hope this helps!
Regards,
Nimesh
Hi Nimesh,
How do you access the logs after that? Can you save them to a file? Are they visible anywhere?
Thank you
Hi @tsroyh,
You can view the logs created by ConsoleNetworkLogger in the Xcode debug console. If you want to save the logs to a file, please create your own logger using the NetworkLogger protocol.
Regards,
Nimesh
Thanks Nimesh!
Is there another step to attach the logger to the ArcGIS SDK/env/map? Just init of ConsoleNetworkLogger and `startLogging()` doesn't seem to produce any logs.
Thank you
Please make sure the instance of the logger is not getting released. If you have a SwiftUI app then you can do this,
import ArcGIS
import SwiftUI
@main
struct ExamplesApp: App {
let logger = ConsoleNetworkLogger(requestOptions: [.method, .body, .headers], responseOptions: [.data, .headers])
init() {
logger.startLogging()
}
var body: some SwiftUI.Scene {
.......
}
}