01. DADOS GERAIS

Produto:

Linha de Produto:PDV Sync
Segmento:

Módulo:

PDVSync Server Controle

Função:Log Centralizado menos verboso e mais assertivo.
País:Brasil
Ticket:
Requisito/Story/Issue (informe o requisito relacionado) :

DVARINT1-13256

Versão:

V1, V2


02. SITUAÇÃO/REQUISITO

03. SOLUÇÃO

Após analise de como o log era gerado optou-se por modificar os logs, para que os mesmos sejam menos verbosos, mais assertivos e também contenham mais informação.


O APPSettings mudou para

    "Serilog": {
        "MinimumLevel": {
            "Default": "Information",
            "Override": {
                "Microsoft": "Warning",
                "System": "Warning",
                "Tnf": "Warning"
            }
        },

Podemos notar acima que apenas o default está como information enquanto os outros logs estão com warning, e incluimos o tnf também como warning isso tornou o log menos verboso.


A adição de pushproperty no log context faz com que a informação seja colocada em uma coluna do log. 

Importante que qualquer informação colocada no pushproperty tem que estar no schema abaixo:

[
  {"name": "partition_time", "type": "TIMESTAMP"},
  {"name": "Timestamp","type": "TIMESTAMP","mode": "NULLABLE","description": "Timestamp of the log entry."},
  {"name": "Level","type": "STRING","mode": "NULLABLE","description": "Log level (e.g., Information, Error, Warning)."},
  {"name": "MessageTemplate","type": "STRING","mode": "NULLABLE","description": "Template for the log message."},
  {"name": "Exception","type": "STRING","mode": "NULLABLE","description": "Exception details, if any."},
  {"name": "Properties","type": "RECORD","mode": "NULLABLE","fields":   [
                {"name": "SourceContext","type": "STRING","mode": "NULLABLE"},
                {"name": "Application","type": "STRING","mode": "NULLABLE"},
                {"name": "Area","type": "STRING","mode": "NULLABLE"},
                {"name": "Enviroment","type": "STRING","mode": "NULLABLE"},
                {"name": "Service","type": "STRING","mode": "NULLABLE"},
                {"name": "Software","type": "STRING","mode": "NULLABLE"},
                {"name": "CpuUsagePercent","type": "FLOAT","mode": "NULLABLE"},
                {"name": "MemoryUsageMB","type": "FLOAT","mode": "NULLABLE"},
                {"name": "MemoryUsagePercent","type": "FLOAT","mode": "NULLABLE"},
                {"name": "ApplicationName","type": "STRING","mode": "NULLABLE"},
                {"name": "RequestHost","type": "STRING","mode": "NULLABLE"},
                {"name": "UserAgent","type": "STRING","mode": "REPEATED"},
                {"name": "ClientIp","type": "STRING","mode": "NULLABLE"},
                {"name": "RequestMethod","type": "STRING","mode": "NULLABLE"},
                {"name": "RequestPath","type": "STRING","mode": "NULLABLE"},
                {"name": "StatusCode","type": "INTEGER","mode": "NULLABLE"},
                {"name": "Elapsed","type": "FLOAT","mode": "NULLABLE"},
                {"name": "RequestId","type": "STRING","mode": "NULLABLE"},
                {"name": "ConnectionId","type": "STRING","mode": "NULLABLE"},
                {"name": "AuthenticationScheme","type": "STRING","mode": "NULLABLE"},
                {"name": "FailureMessage","type": "STRING","mode": "NULLABLE"},
                {"name": "EventId","type": "RECORD","mode": "NULLABLE","fields":[
                        {"name": "Id","type": "INTEGER","mode": "NULLABLE"},
                        {"name": "Name","type": "STRING","mode": "NULLABLE"}]},
                {"name": "ActionId","type": "STRING","mode": "NULLABLE"},
                {"name": "ActionName","type": "STRING","mode": "NULLABLE"},
                {"name": "RegistrosRecebidos","type": "INTEGER","mode": "NULLABLE"},
                {"name": "LoteOrigem","type": "STRING","mode": "NULLABLE"},
                {"name": "IdInquilino","type": "STRING","mode": "NULLABLE"},
                {"name": "APIVersion","type": "INTEGER","mode": "NULLABLE"},
                {"name": "RegistrosCount","type": "INTEGER","mode": "NULLABLE"},
                {"name": "Elapsedms","type": "FLOAT","mode": "NULLABLE"},
                {"name": "ElapsedMilliseconds","type": "INTEGER","mode": "NULLABLE"},
                {"name": "RegistrosProcessados","type": "INTEGER","mode": "NULLABLE"},
                {"name": "Inquilino","type": "STRING","mode": "NULLABLE"},
                {"name": "RegistrosRetornados","type": "INTEGER","mode": "NULLABLE"},
                {"name": "Lote","type": "STRING","mode": "NULLABLE"},
                {"name": "sequencial","type": "INTEGER","mode": "NULLABLE"},
                {"name": "qtdRegistros","type": "INTEGER","mode": "NULLABLE"},
                {"name": "DataBusca","type": "STRING","mode": "NULLABLE"}
        ]},
        {"name": "Renderings","type": "RECORD","mode": "NULLABLE","fields": [
                {"name": "Elapsed","type": "RECORD","mode": "REPEATED","fields": [
                        {"name": "Format","type": "STRING","mode": "NULLABLE"},
                        {"name": "Rendering","type": "STRING","mode": "NULLABLE"}
                ]},
                {"name": "Elapsedms","type": "RECORD","mode": "REPEATED","fields": [
                        {"name": "Format","type": "STRING","mode": "NULLABLE"},
                        {"name": "Rendering","type": "STRING","mode": "NULLABLE"}
                ]}
        ]}
]



Importante colocar os pushProperties, principalmente com as informações relevantes que existirem no momento, como por exemplo inquilino, lote origem, lote registros recebidos, registros processados e registros retornados.