question

AppyNation Ltd. avatar image
AppyNation Ltd. asked

[Unity iOS Plugin] Logging cannot be disabled

It looks like the EnableLogging call is ignored.

Doing this:

var testing = new ShouldEnable();
testing.BooleanValue = false;
AmazonMobileAdsImpl.Instance.EnableTesting(testing);

Doesn't stop the logging.

mobile ads
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

justin avatar image
justin answered

Hi AppyNation,

Have you instantiated the instance prior to disabling? Also, your sample provided is for EnablesTesting, not EnablesLogging.

It should be

private IAmazonMobileAds mobileAds;
public ShouldEnable testing = new ShouldEnable();

void Start() {
  mobileAds = IAmazonMobileAdsImp.Instance;
  testing.BooleanValue = false;
  mobileAds.EnableLogging(testing);
}
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

AppyNation Ltd. avatar image
AppyNation Ltd. answered
Yes, sorry, I inserted the wrong code snippet into my post. My code is correct. Here's my initialisation code: mobileAds = AmazonMobileAdsImpl.Instance; var key = new ApplicationKey(); key.StringValue = "81152c44dde649c285697656584542b0";//occw mobileAds.SetApplicationKey(key); var logging = new ShouldEnable(); logging.BooleanValue = false; mobileAds.EnableLogging(logging); var testing = new ShouldEnable(); testing.BooleanValue = false; mobileAds.EnableTesting(testing); var geoLocation = new ShouldEnable(); geoLocation.BooleanValue = false; mobileAds.EnableGeoLocation(geoLocation); mobileAds.AddAdLoadedListener(OnAdLoaded); mobileAds.AddAdFailedToLoadListener(OnAdFailedToLoad); mobileAds.AddAdDismissedListener(OnAdDismissed); mobileAds.AddAdCollapsedListener(OnAdCollapsed); mobileAds.AddAdExpandedListener(OnAdExpanded); mobileAds.AddAdResizedListener(OnResized); And here's an example of what is logged: [i] AmazonMobileAdsUnityIPhone: Successfully called native code in 3 ms UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:SetApplicationKeyJson(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:SetApplicationKey(ApplicationKey) Test:Init() Test:OnGUI() (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) AmazonMobileAdsUnityIPhone: Successfully called native code in 0 ms UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:EnableLoggingJson(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:EnableLogging(ShouldEnable) Test:Init() Test:OnGUI() (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) AmazonMobileAdsUnityIPhone: Successfully called native code in 0 ms UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:EnableTestingJson(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:EnableTesting(ShouldEnable) Test:Init() Test:OnGUI() (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) AmazonMobileAdsUnityIPhone: Successfully called native code in 0 ms UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:EnableGeoLocationJson(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:EnableGeoLocation(ShouldEnable) Test:Init() Test:OnGUI() (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) AmazonMobileAdsUnityIPhone: Successfully called native code in 27 ms UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:CreateFloatingBannerAdJson(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:CreateFloatingBannerAd(Placement) Test:LoadAndShowBanner(Dock) Test:OnGUI() (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) AmazonMobileAdsUnityIPhone: Successfully called native code in 350 ms UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:LoadAndShowFloatingBannerAdJson(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:LoadAndShowFloatingBannerAd(Ad) Test:LoadAndShowBanner(Dock) Test:OnGUI() (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) 2015-12-10 07:57:22.886 amazonmobileads[2043:1604311] -[NSError init] called; this results in an invalid NSError instance. It will raise an exception in a future release. Please call errorWithDomain:code:userInfo: or initWithDomain:code:userInfo:. This message shown only once. 2015-12-10 07:57:22.889 amazonmobileads[2043:1604311] Ad Failed to load. Error code 1: Try again in 9.999983 seconds. 2015-12-10 07:57:22.889 amazonmobileads[2043:1604311] Ad has failed to load AmazonMobileAdsUnityIPhone: eventReceived UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsImpl:FireEvent(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:UnityFireEvent(String) (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.Collections.Generic.List`1+Enumerator[com.amazon.mas.cpt.ads.IDelegator].VerifyState () [0x00000] in :0 at System.Collections.Generic.List`1+Enumerator[com.amazon.mas.cpt.ads.IDelegator].MoveNext () [0x00000] in :0 at com.amazon.mas.cpt.ads.AmazonMobileAdsImpl.FireEvent (System.String jsonMessage) [0x00000] in :0 at com.amazon.mas.cpt.ads.AmazonMobileAdsImpl+AmazonMobileAdsBase.UnityFireEvent (System.String jsonMessage) [0x00000] in :0 (Filename: Line: -1) AmazonMobileAdsUnityIPhone: Successfully called native code in 1 ms UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:IsInterstitialAdReadyJson(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:IsInterstitialAdReady() Test:IsInterstitialLoaded() Test:OnGUI() (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) AmazonMobileAdsUnityIPhone: Successfully called native code in 0 ms UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:IsInterstitialAdReadyJson(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:IsInterstitialAdReady() Test:IsInterstitialLoaded() Test:LoadInterstitial() Test:OnGUI() (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) AmazonMobileAdsUnityIPhone: Successfully called native code in 3 ms UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:CreateInterstitialAdJson(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:CreateInterstitialAd() Test:LoadInterstitial() Test:OnGUI() (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) 2015-12-10 07:57:29.668 amazonmobileads[2043:1604311] Interstitial failed to load. AmazonMobileAdsUnityIPhone: Successfully called native code in 3 ms UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:LoadInterstitialAdJson(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:LoadInterstitialAd() Test:LoadInterstitial() Test:OnGUI() (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) AmazonMobileAdsUnityIPhone: eventReceived UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) com.amazon.mas.cpt.ads.log.AmazonLogging:Log(AmazonLoggingLevel, String, String) com.amazon.mas.cpt.ads.AmazonLogger:Debug(String) com.amazon.mas.cpt.ads.AmazonMobileAdsImpl:FireEvent(String) com.amazon.mas.cpt.ads.AmazonMobileAdsBase:UnityFireEvent(String) (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64) InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.Collections.Generic.List`1+Enumerator[com.amazon.mas.cpt.ads.IDelegator].VerifyState () [0x00000] in :0 at System.Collections.Generic.List`1+Enumerator[com.amazon.mas.cpt.ads.IDelegator].MoveNext () [0x00000] in :0 at com.amazon.mas.cpt.ads.AmazonMobileAdsImpl.FireEvent (System.String jsonMessage) [0x00000] in :0 at com.amazon.mas.cpt.ads.AmazonMobileAdsImpl+AmazonMobileAdsBase.UnityFireEvent (System.String jsonMessage) [0x00000] in :0 (Filename: Line: -1) [/i]
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andrew@Amazon avatar image
Andrew@Amazon answered
Hi AppyNation, The EnableLogging() API appears to be working as intended. The API enables/disables logging from our Mobile Ads SDK, only (the same logs you would see if you were to integrate the raw iOS SDK instead of the Unity Plugin). These logs you are seeing are coming from our Unity framework and are not currently controlled by that API. I will forward this request to the appropriate development team, though.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

AppyNation Ltd. avatar image
AppyNation Ltd. answered
Ok, I hope they can fix asap.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

AppyNation Ltd. avatar image
AppyNation Ltd. answered
What's the progress of this? I want to stop the logging.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

justin avatar image
justin answered
Hi AppyNation Ltd. This issue is being tracked internally, and a workaround has been suggested to prevent this in the meant time: You can directly edit the Debug(String msg) method in the AmazonLogger class to call the AmazonLogging.Log method with a different logging level than AmazonLogging.AmazonLoggingLevel.Verbose. I hope this helps, and am terribly sorry for the delay in response.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.