Closed pf-burak-sinan closed 1 year ago
Hi @pf-burak-sinan, thanks for opening this issue. Can you share the full code you're using to initialize the SDK and to create your logger? Also which version of the SDK are you using?
Sure! SDK version: 1.13.0-rc1
val configuration = Configuration.Builder(
logsEnabled = true,
tracesEnabled = true,
crashReportsEnabled = true,
rumEnabled = false,
)
.sampleTelemetry(INFO_TELEMETRY_SAMPLING_RATE)
.setUseDeveloperModeWhenDebuggable(true)
.build()
val credentials = Credentials(
clientToken = clientToken,
envName = environment,
variant = String.EMPTY,
rumApplicationId = BuildConfig.APPLICATION_ID,
serviceName = LoggerConstants.LOGGER_SERVICE_NAME,
)
Datadog.setVerbosity(Log.VERBOSE)
Datadog.initialize(
context = context,
credentials = credentials,
configuration = configuration,
trackingConsent = TrackingConsent.GRANTED
)
val tracer = AndroidTracer.Builder()
.setPartialFlushThreshold(PARTIAL_FLUSH_THRESHOLD)
.setServiceName(LoggerConstants.LOGGER_SERVICE_NAME)
.addGlobalTag(LoggerConstants.Tags.BUILD_CONFIGURATION, BuildConfig.BUILD_TYPE)
.addGlobalTag(LoggerConstants.Tags.BUILD, BuildConfig.VERSION_CODE.toString())
.build()
GlobalTracer.registerIfAbsent(tracer)
logger = Logger.Builder()
.setNetworkInfoEnabled(true)
.setDatadogLogsEnabled(true)
.setLogcatLogsEnabled(true)
.build()
.apply {
addTag(LoggerConstants.Tags.BUILD_CONFIGURATION, BuildConfig.BUILD_TYPE)
addAttribute(LoggerConstants.Tags.BUILD, BuildConfig.VERSION_CODE.toString())
}
One more thing, although logcat shows "sent successfully" I still cannot see the log on the console.
2022-06-21 10:44:53.460 22041-22125/ae.propertyfinder.propertyfinder V/Datadog: Batch efde56d1-0d02-4f42-9435-1446fe08abdf [5851 bytes] (pa5) sent successfully.
Unfortunately I don't see anything wrong with your setup here. Can you open up a ticket with our support so we can have more info and schedule up a call to debug this please?
Yeah sure, opened it.
Having the same issue. Datadog does seem to track RUM events and crashes. But no logs.
Hi @ntoskrnl do you have a small sample app reproducing the issue that you could share with us?
Thanks to this exercise I found the problem in my setup:
com.datadog.android.log.Logger
was created before Datadog.initialize()
. As a result, they were not sent (or probably even recorded).
@pf-burak-sinan in my case logger
was declared and initialized in a companion object.
Yes indeed the Logger object needs to be created after Datadog's global initialisation. Otherwise, it's initialise without knowledge of how it needs to store/send the logs, and defaults to a no-op implementation.
I set sdk up correctly. Everything works fine with debug build. When it comes to release build, I can see traces but not logs on the console. So far I checked lots of things but no chance. Logs are showing only if I set release package as debbugable = true.
What I expected was seeing logs even if they are obfuscated. That's also a missing feature. Mapping.txt file works only for RUM traces which we don't use, never mind.
I searched in issues and docs for related content but no chance. There was a similar issue caused by siteUrl, I checked it also and set it as US1 even if it is already default. Again it didn't work.
Additional context Gradle version: 7.1.2 OS version: MacOS 12.4 Plugin version: 1.4.0 Proguard configuration: enabled Other Gradle Plugins: id("com.android.application") id("kotlin-android") id("kotlin-kapt") id("dagger.hilt.android.plugin") id("com.google.gms.google-services") id("com.google.firebase.crashlytics") id("kotlin-parcelize")