newrelic / newrelic-flutter-agent

New Relic agent SDK for Flutter hybrid mobile apps
Apache License 2.0
6 stars 12 forks source link

Unable to find Flutter logs on NewRelic dashboard #115

Closed akaegi closed 4 weeks ago

akaegi commented 1 month ago

I am unable to find logs in NewRelic dashboard for my Flutter mobile app (Android). Logcat reports that report is sent to NewRelic:

newrelic: {level=ERROR,message=[DevActionsView] Demo fatal error message}

However I don't find the logs in the dashboard, not when querying like this (as read in your forum):

SELECT * FROM `Mobile Dart Console Events` SINCE 1 day AGO

and also not in the "Logs" tab: image

I tried to enable Logs in the "Application Settings" but that didn't help either image

What am I doing wrong, am I looking at the wrong "table"?

ndesai-newrelic commented 1 month ago

@akaegi can you change log verbosity and also share check charles traces for logs?

akaegi commented 1 month ago

Hi @ndesai-newrelic, I guess you mean the HTTP proxy tool Charles, right? I did a session with Proxyman and an iOS simulator, on my Android I didn't succeed with that...

Screenshot 2024-10-02 at 13 29 21

Screenshot 2024-10-02 at 13 30 04

Screenshot 2024-10-02 at 13 30 29

New relic configuration in Flutter:

Config newRelicConfiguration(String appToken) => Config(
      accessToken: appToken,
      //(Android only) Enable or disable collection of event data.
      analyticsEventEnabled: false,
      // https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/configure-settings/#flutter
      backgroundReportingEnabled: false,
      // Enable or disable crash reporting.
      crashReportingEnabled: true,
      distributedTracingEnabled: false,
      httpInstrumentationEnabled: false,
      httpResponseBodyCaptureEnabled: false,
      interactionTracingEnabled: false,
      loggingEnabled: true,
      logLevel: LogLevel.INFO,
      networkErrorRequestEnabled: false,
      networkRequestEnabled: false,
      // (iOS Specific) Optional: Enable or disable to use our new, more stable, event system for iOS agent.
      newEventSystemEnabled: true,
      // Enable or disable offline data storage when no internet connection is available.
      // To configure the amount of offline storage, see https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/set-max-offline-storage/#flutter.
      offlineStorageEnabled: true,
      printStatementAsEventsEnabled: false,
      webViewInstrumentation: false,
    );
ndesai-newrelic commented 1 month ago

@akaegi can you check you mobile logs in application settings one more time?

akaegi commented 1 month ago

They look like this in both applications: image

ndesai-newrelic commented 1 month ago

@akaegi we are unable to reproduce it from our side, if possible can you share sample app where you reproduce the issue?

akaegi commented 4 weeks ago

Sorry @ndesai-newrelic I was in holidays... Just checked it again and now it works!! 😀 Cannot explain why though... Just as a side question (sorry for hijacking): Is there any way to show userId or other custom attributes for log messages?

ndesai-newrelic commented 4 weeks ago

@akaegi you can use logattributes method and also use sessionId to attach logs with userId.

akaegi commented 4 weeks ago

Ok thank you @ndesai-newrelic ! I've seen the sessionId in the log entry. How can I look up the userId and other attributes tied to the sessionId (in the dashboard) (or attach it if that's not done automatically). Sorry, maybe you can just hint me at the relevant docs 😬