Skip to main content

Logging

Maxime avatar
Written by Maxime
Updated over 4 months ago

Available logs

PSD2 hub uses nLog ( https://nlog-project.org/) framework for logging. The standard target is MongoDB.

The standard target is MongoDB. Configuration os controlled by Docker env file: Docker env file

Log structure

Every log document in Mongo contains the following information:

{
"_id" : ObjectId("5e85ac59d47cb80001d1423b"), - unique identified of the log entry (Mongo DB document)
"level" : "Error", - log entry level (Info, Debug, Warn, Error, Fatal)
"logger" : "TryExecuteSingle", - name of the component
"message" : "Error while executing bus request.", - log message
"date" : ISODate("2020-04-02T11:11:53.345+02:00"), - log timestamp
"type" : "Log Message",
"executionData" : {
"ignoreLog" : false,
"externalUserId" : "tvEwzwNuvByCtQrw", - id of the user (externaluserid) - select * from aspnetusers where externaluserid={}
"id" : "ae28e240-14eb-43ec-b298-eef2cfeca3a8", - trace identifier. Trace provided end-2-end session audit log (below you fill find an instruction how to find the trace based on executionId as provided in PSD2Hub API response)
"logId" : "d72e08e2-475a-4878-b7c8-d1c8c28b0c2f", - identifier that is provided in API response as failureMessageId (below you fill find an instruction how to find the trace based on failureMessageId as provided in PSD2Hub API response)
"invoker" : "Api", - component responsible for invoking method
"extraData" : null
},
"machine" : {
"entryAssembly" : "Psd2Hub.Connectors.PolishApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", - software component identifier
"machineName" : "108224e22636", - name of the machine (image)
"processName" : "dotnet",
"memorySize" : 0 - available memory size (if applicable)
}
}

Finding logs

How to find the trace based on executionId as provided in PSD2Hub API response

db.getCollection('<LOG_COLLECTION>').find({'http://executiondata.id/':'<EXECUTIONID>}).sort({date:-1})

How to find the trace based on executionId as failureMessageId in PSD2Hub API response

db.getCollection('<LOG_COLLECTION>').find({'http://executiondata.logid/':'<EXECUTIONID>}).sort({date:-1})

How to find the newest errors
db.getCollection('<LOG_COLLECTION>').find({'level':/.*Error.*/}).sort({date:-1})

Did this answer your question?