1. 拡張xConnectログ

xConnect操作のログ設定

Version:
日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

拡張xConnectログには、xConnectコマンドと、コマンドの実行前と実行後の操作の状態の追跡が含まれます。

各操作には一意のバッチIDがあります。操作が失敗した場合は、先行操作と後続操作の操作IDもログに記録されます。デフォルトでは無効になっています。

xConnect操作ログ出力には、各コマンド実行のログ エントリとBatchIdフィールドが含まれます。このBatchIdを使用して、関連するコマンドのログを見つけることができます。

ログ出力には、次のものが含まれます。

  • バッチID。

  • 操作名。

  • バッチ内の操作ID。

  • 操作実行のステータス。

  • 操作パラメータ (連絡先ID、IDフィールド、ファセット情報など)。

  • 先行処理または後続処理の操作ID。

xConnect操作のログ記録を有効にする

xConnect操作のログ記録を有効にするには、次の手順を実行します。

  • ファイルの名前を\App_Data\Config\Sitecore\Collection\sc.XConnect.Collection.Web.Logging.xmlに変更して、ファイル\App_Data\Config\Sitecore\Collection\sc.XConnect.Collection.Web.Logging.xml.disabledを有効にします。

xConnect操作ログの例

xConnect操作ログ出力には、各コマンド実行のログ エントリが含まれます。例えば:

2021-05-31 21:26:20.695 +03:00 [Verbose] Operation trace 
{ 
  "BatchId": "e24aa982-875e-4c2e-a2d8-3ef61dba68a9", 
  "Command": "Executed", 
  "Operations": [ 
    { 
      "BatchId": "e24aa982-875e-4c2e-a2d8-3ef61dba68a9", 
      "BatchIndex": 0, 
      "OperationName": "AddContactOperation", 
      "OperationId": 9, 
      "Status": "Succeeded", 
      "OperationType": "Create", 
      "Info": [ 
        { 
          "Name": "Parameters", 
          "Value": [ 
            { 
              "Name": "Contact id", 
              "Value": "edb8f791-b618-0000-0000-062578a79910" 
            }, 
            { 
              "Name": "Identifiers", 
              "Value": [ 
                [ 
                  { 
                    "Name": "Identifier type", 
                    "Value": "Anonymous" 
                  }, 
                  { 
                    "Name": "Source", 
                    "Value": "Tests.contact.source" 
                  }, 
                  { 
                    "Name": "Value", 
                    "Value": ".13.M.MergeOperationShouldFailIfOneOfContactsIsNull7a7bd39e7bb94f09905d3184d3df4d2c" 
                  } 
                ], 
                [ 
                  { 
                    "Name": "Identifier type", 
                    "Value": "Anonymous" 
                  }, 
                  { 
                    "Name": "Source", 
                    "Value": "Alias" 
                  }, 
                  { 
                    "Name": "Value", 
                    "Value": "903aa80a-556f-4b9c-9149-9846dea55718" 
                  } 
                ] 
              ] 
            } 
          ] 
        }, 
        { 
          "Name": "Successors Ids", 
          "Value": "[ 11 ]" 
        } 
      ] 
    }, 
    { 
      "BatchId": "e24aa982-875e-4c2e-a2d8-3ef61dba68a9", 
      "BatchIndex": 2, 
      "OperationName": "SetFacetOperation`1", 
      "OperationId": 11, 
      "Status": "Succeeded", 
      "OperationType": "Update", 
      "Info": [ 
        { 
          "Name": "Parameters", 
          "Value": [ 
            { 
              "Name": "Entity type", 
              "Value": "Contact" 
            }, 
            { 
              "Name": "Entity id", 
              "Value": "edb8f791-b618-0000-0000-062578a79910" 
            }, 
            { 
              "Name": "Facet key", 
              "Value": "Personal" 
            } 
          ] 
        }, 
        { 
          "Name": "Predecessors Ids", 
          "Value": "[ 9 ]" 
        } 
      ] 
    } 
  ] 
} 

ログ・レベルの変更

xConnect操作の実行中に例外がスローされた場合、次のいずれかのタイプがログに記録されます。

  • Only type (例外のタイプのみ)。

  • Medium (例外とメッセージのタイプ)。

  • Full (例外インスタンスに含まれる完全な情報)。

デフォルトでは、ログ・タイプ・レベルはMediumです。

ログ・タイプ・レベルを変更するには、次のようにします。

  • 構成ファイル\App_Data\Config\Sitecore\Collection\sc.XConnect.Collection.Web.Logging.xmlを開き、Settings/Sitecore/XConnect/Collection/Services/ExceptionLogFormatter/Options/ExceptionLogLevelノードの値を変更します。

    <ExceptionLogLevel>Medium</ExceptionLogLevel>

OnlyTypeレベルの例外の例

以下は、OnlyTypeログレベルでのログ出力の例です。

2021-05-31 21:59:14.581 +03:00 [Verbose] Operation trace 
{ 
  "BatchId": "3813c258-ae24-4a61-974f-62daa2f83bee", 
  "Command": "Executed", 
  "Operations": [ 
    { 
      "BatchId": "3813c258-ae24-4a61-974f-62daa2f83bee", 
      "BatchIndex": 0, 
      "OperationName": "AddContactOperation", 
      "OperationId": 1, 
      "Status": "Failed", 
      "OperationType": "Create", 
      "Info": [ 
        { 
          "Name": "Exception", 
          "Value": "ShardManagementException" 
        } 
      ] 
    } 
  ] 
}

中レベルの例外の例:

以下は、Mediumログレベルでのログ出力の例です。

2021-05-31 21:52:23.726 +03:00 [Verbose] Operation trace 
{ 
  "BatchId": "a2e0e099-9be3-428b-98c9-a6c45c334859", 
  "Command": "Executed", 
  "Operations": [ 
    { 
      "BatchId": "a2e0e099-9be3-428b-98c9-a6c45c334859", 
      "BatchIndex": 0, 
      "OperationName": "AddContactOperation", 
      "OperationId": 1, 
      "Status": "Failed", 
      "OperationType": "Create", 
      "Info": [ 
        { 
          "Name": "Exception", 
          "Value": { 
            "Name": "ShardManagementException", 
            "Message": "Store Error: Login failed for user 'sa'.. The error occurred while attempting to perform the 
            underlying storage operation during 'Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.StoreException
            : Error occurred while performing store operation. See the inner SqlException for details. ---> System
            .Data.SqlClient.SqlException: Login failed for user 'sa'.\r\n   at System.Data.SqlClient
            .SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, 
            SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean 
            redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, 
            DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, 
            SqlAuthenticationProviderManager sqlAuthProviderManager)\r\n   at System.Data.SqlClient.SqlConnectionFactory
            .CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, 
            DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)\r\n   at System.Data
            .ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, 
            DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)\r\n   at System
            .Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)\r\n   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest
            (DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)\r\n   at 
            System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 
            waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions 
            userOptions, DbConnectionInternal& connection)\r\n   at System.Data.ProviderBase.DbConnectionPool
            .TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, 
            DbConnectionInternal& connection)\r\n   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection
            (DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, 
            DbConnectionInternal oldConnection, DbConnectionInternal& connection)\r\n   at System.Data.ProviderBase
            .DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory 
            connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)\r\n   at System.Data
            .SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)\r\n   at System.Data.SqlClient
            .SqlConnection.TryOpen(TaskCompletionSource`1 retry)\r\n   at System.Data.SqlClient.SqlConnection.Open()\r\n   at Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.SqlUtils.WithSqlExceptionHandling(Action 
            operation)\r\n   --- End of inner exception stack trace ---\r\n   at Microsoft.Azure.SqlDatabase
            .ElasticScale.ShardManagement.SqlUtils.WithSqlExceptionHandling(Action operation)\r\n   at Microsoft.Azure
            .SqlDatabase.ElasticScale.ShardManagement.StoreOperationGlobal.<Do>b__10_0()\r\n   at Microsoft.Azure
            .SqlDatabase.ElasticScale.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)\r\n   at 
            Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.StoreOperationGlobal.Do()' operation on the shard 
            map manager database. See the inner StoreException for details." 
          } 
        } 
      ] 
    } 
  ] 
} 

フル レベルの例外の例:

以下は、Fullログレベルでのログ出力の例です。

2021-05-31 22:02:03.197 +03:00 [Verbose] Operation trace 
{ 
  "BatchId": "febf5249-fbf6-4d52-a9ef-3941cac2c31b", 
  "Command": "Executed", 
  "Operations": [ 
    { 
      "BatchId": "febf5249-fbf6-4d52-a9ef-3941cac2c31b", 
      "BatchIndex": 0, 
      "OperationName": "AddContactOperation", 
      "OperationId": 1, 
      "Status": "Failed", 
      "OperationType": "Create", 
      "Info": [ 
        { 
          "Name": "Exception", 
          "Value": { 
            "ErrorCategory": 0, 
            "ErrorCode": 17, 
            "ClassName": "Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.ShardManagementException", 
            "Message": "Store Error: Login failed for user 'sa'.. The error occurred while attempting to perform the 
            underlying storage operation during 'Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.StoreException
            : Error occurred while performing store operation. See the inner SqlException for details. ---> System
            .Data.SqlClient.SqlException: Login failed for user 'sa'.\r\n   at System.Data.SqlClient
            .SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, 
            SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean 
            redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, 
            DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, 
            SqlAuthenticationProviderManager sqlAuthProviderManager)\r\n   at System.Data.SqlClient.SqlConnectionFactory
            .CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, 
            DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)\r\n   at System.Data
            .ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, 
            DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)\r\n   at System
            .Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)\r\n   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest
            (DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)\r\n   at 
            System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 
            waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions 
            userOptions, DbConnectionInternal& connection)\r\n   at System.Data.ProviderBase.DbConnectionPool
            .TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, 
            DbConnectionInternal& connection)\r\n   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection
            (DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, 
            DbConnectionInternal oldConnection, DbConnectionInternal& connection)\r\n   at System.Data.ProviderBase
            .DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory 
            connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)\r\n   at System.Data
            .SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)\r\n   at System.Data.SqlClient
            .SqlConnection.TryOpen(TaskCompletionSource`1 retry)\r\n   at System.Data.SqlClient.SqlConnection.Open()\r\n   at Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.SqlUtils.WithSqlExceptionHandling(Action 
            operation)\r\n   --- End of inner exception stack trace ---\r\n   at Microsoft.Azure.SqlDatabase
            .ElasticScale.ShardManagement.SqlUtils.WithSqlExceptionHandling(Action operation)\r\n   at Microsoft.Azure
            .SqlDatabase.ElasticScale.ShardManagement.StoreOperationGlobal.<Do>b__10_0()\r\n   at Microsoft.Azure
            .SqlDatabase.ElasticScale.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)\r\n   at 
            Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.StoreOperationGlobal.Do()' operation on the shard 
            map manager database. See the inner StoreException for details.", 
            "Data": null, 
            "InnerException": null, 
            "HelpURL": null, 
            "StackTraceString": "at Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.StoreOperationGlobal.Do
            ()\r\n   at Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.ShardMapManagerFactory
            .GetSqlShardMapManager(String connectionString, SqlCredential secureCredential, ShardMapManagerLoadPolicy 
            loadPolicy, RetryBehavior retryBehavior, EventHandler`1 retryEventHandler, Boolean throwOnFailure)\r\n   at 
            Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.ShardMapManagerFactory.TryGetSqlShardMapManager
            (String connectionString, SqlCredential secureCredential, ShardMapManagerLoadPolicy loadPolicy, 
            RetryBehavior retryBehavior, ShardMapManager& shardMapManager)\r\n   at Sitecore.Xdb.Collection.Data
            .SqlServer.Configuration.ElasticScaleConnectionManager.InitializeShardMapManager()\r\n   at Sitecore.Xdb
            .Collection.Data.SqlServer.Configuration.ElasticScaleConnectionManager.get_ShardMapManager()\r\n   at 
            Sitecore.Xdb.Collection.Data.SqlServer.Configuration.ElasticScaleConnectionManager.GetRangeShardMap(String 
            rangeShardMapName)\r\n   at Sitecore.Xdb.Collection.Data.SqlServer.Configuration
            .ElasticScaleConnectionManager.<>c__DisplayClass33_0.<GetRangeMappings>b__0()\r\n   at System.Lazy`1
            .CreateValue()\r\n   at System.Lazy`1.LazyInitValue()\r\n   at Sitecore.Xdb.Collection.Data.SqlServer
            .Configuration.MemoryCacheManager.AddOrGetExistingFromCache[T](String key, Func`1 valueFactory)\r\n   at 
            Sitecore.Xdb.Collection.Data.SqlServer.Configuration.ElasticScaleConnectionManager.MapRecordsToShards[T]
            (String rangeShardMapName, IReadOnlyCollection`1 records, Func`2 getShardKey)\r\n   at Sitecore.Xdb
            .Collection.Data.SqlServer.Managers.SqlContactRecordsManager.<SaveContactIdentifierIndexRecords>d__29
            .MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System
            .Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Sitecore.Xdb.Collection.Data.SqlServer
            .Managers.SqlContactRecordsManager.<TrySaveChangesAsync>d__18.MoveNext()\r\n--- End of stack trace 
            from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices
            .ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter
            .HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Sitecore.Xdb.Collection.Data.SqlServer
            .SqlDataProvider.<Save>d__16.MoveNext()\r\n--- End of stack trace from previous location where 
            exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at 
            System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at 
            Sitecore.Xdb.Collection.DataProviderCountersDecorator.<Save>d__24.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices
            .ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter
            .HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Sitecore.Xdb.Collection.Repository.<Save>d__12.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at 
            System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices
            .TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Sitecore.XConnect.Service
            .RepositorySaveOperationInvoker.<Execute>d__10.MoveNext()", 
            "RemoteStackTraceString": null, 
            "RemoteStackIndex": 0, 
            "ExceptionMethod": "8\nDo\nMicrosoft.Azure.SqlDatabase.ElasticScale.Client, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null\nMicrosoft.Azure.SqlDatabase.ElasticScale.ShardManagement.StoreOperationGlobal\nMicrosoft.Azure.SqlDatabase.ElasticScale.ShardManagement.IStoreResults Do()", 
            "HResult": -2146233088, 
            "Source": "Microsoft.Azure.SqlDatabase.ElasticScale.Client", 
            "WatsonBuckets": null 
          } 
        } 
      ] 
    } 
  ] 
} 
この記事を改善するための提案がある場合は、 お知らせください!