Giter VIP home page Giter VIP logo

Comments (10)

danielts90 avatar danielts90 commented on September 6, 2024 1

Now it's Ok
image
image

from kisslog.sdk.

catalingavan avatar catalingavan commented on September 6, 2024 1

Perfect. You helped me discover a misplaced validation rule on the server, thank you!
You can change the code back as it was previously, and it should work ok now.
Sorry for that.

from kisslog.sdk.

danielts90 avatar danielts90 commented on September 6, 2024 1

I'm so happy for contribute,
Is the first time that i open a github issue.

from kisslog.sdk.

catalingavan avatar catalingavan commented on September 6, 2024

Hi Daniel,

Can you please share from the Startup.cs file the Configure(IApplicationBuilder app) method?

from kisslog.sdk.

danielts90 avatar danielts90 commented on September 6, 2024

Yes,
I divided Startup into several classes,
if you need any more, let me know.

LogStartup.txt
Startup.txt

from kisslog.sdk.

catalingavan avatar catalingavan commented on September 6, 2024

In AspNetCore the order of the Middleware is important, and I suspect this might be the issue.

I will need a copy of the physical log file which works ok, and the KissLog Internal Logs (you can save them to a StringBuilder):

static StringBuilder sb = new StringBuilder();

options.InternalLog = (message) =>
{
    sb.AppendLine(message);
};

image

To simplify the code, can you temporary change the Startup.cs to the following, and see if this makes a difference?

I copied the LogStartup.cs into the Startup.cs, and I also added the app.UseAuthorization(); and app.UseAuthentication();.

namespace Spx.Cor.Exportacao.Api
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuracao = configuration;
        }

        public IConfiguration Configuracao { get; }

        /// <summary>
        /// This method gets called by the runtime. Use this method to add services to the container.
        /// </summary>
        public void ConfigureServices(IServiceCollection servicos)
        {
            servicos.AddCorsCustomizado(Configuracao);

            servicos.AddDommelCustomizado();

            servicos.AddMemoryCache();

            servicos.AddHealthChecksCustomizado(Configuracao);

            servicos.AddAutoMapperCustomizado();

            servicos.AddAutenticacaoCustomizada(Configuracao);

            servicos.AddMvcCustomizado();

            servicos.AddSwaggerCustomizado(Configuracao);

            servicos.AddDICustomizado();

            servicos.AddLogCustomizado(Configuracao);
        }

        /// <summary>
        /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        /// </summary>
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseCorsCustomizado(env);

            app.UseExcecaoCustomizada();

            app.UseSwaggerCustomizado();

            app.UseHealthChecksCustomizado();

            app.UseMvcCustomizado();

            app.UseStaticFiles();
            app.UseRouting();
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseSession();

	    app.UseKissLogMiddleware(options => {
                ConfigureKissLog(options, Configuracao);
            });

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
		
	private static void ConfigureKissLog(IOptionsBuilder options, IConfiguration configuracao)
        {
            // optional KissLog configuration
            options.Options
                .AppendExceptionDetails((Exception ex) =>
                {
                    StringBuilder sb = new StringBuilder();

                    if (ex is System.NullReferenceException nullRefException)
                    {
                        sb.AppendLine("Important: check for null references");
                    }

                    return sb.ToString();
                });

            // KissLog internal logs
            options.InternalLog = (message) =>
            {
                Debug.WriteLine(message);
            };

            RegisterKissLogListeners(options, configuracao);
        }

        private static void RegisterKissLogListeners(IOptionsBuilder options, IConfiguration configuracao)
        {
            // multiple listeners can be registered using KissLogConfiguration.Listeners.Add() method

            // Register KissLog.net cloud listener
            options.Listeners.Add(new RequestLogsApiListener(new Application(
                configuracao["KissLog.OrganizationId"],
                configuracao["KissLog.ApplicationId"])
            )
            {
                ApiUrl = configuracao["KissLog.ApiUrl"]
            });

            // Register local text files listener
            options.Listeners.Add(new LocalTextFileListener(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs"))
            {
                FlushTrigger = FlushTrigger.OnMessage
            });
        }
    }
}

from kisslog.sdk.

danielts90 avatar danielts90 commented on September 6, 2024

The Kisslog log shows an invalid parameters error

'KissLog' 2021-01-21T13:42:14Z [Trace] RequestLogsApiListener: OnFlush begin
'KissLog' 2021-01-21T13:42:14Z [Trace] POST https://api.kisslog.net/api/public/v1.0/createRequestLog begin
'KissLog' 2021-01-21T13:42:14Z [Trace] RequestLogsApiListener: OnFlush complete
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 1518.9013ms 200 application/json; charset=utf-8
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Request","time":"2021-01-21T13:42:13.0415767Z","tags":{"ai.application.ver":"1.0.0.0","ai.cloud.roleInstance":"001-TBL-1086","ai.user.id":"MYr1da/mmvtyAhvCeWhWHe","ai.operation.id":"9f5866b6dade774bb0edc404aaa34ab0","ai.operation.name":"GET Emails/GetEmail [version]","ai.location.ip":"::1","ai.internal.sdkVersion":"aspnet5c:2.13.1","ai.internal.nodeName":"001-TBL-1086.supermix.com.br"},"data":{"baseType":"RequestData","baseData":{"ver":2,"id":"ef1c8ab28c87c843","name":"GET Emails/GetEmail [version]","duration":"00:00:01.5521875","success":true,"responseCode":"200","url":"https://localhost:44307/v1/Email/getEmail?email=teste%40teste.com","properties":{"DeveloperMode":"true","_MS.ProcessedByMetricExtractors":"(Name:'Requests', Ver:'1.1')","AspNetCoreEnvironment":"loc"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.RemoteDependency","time":"2021-01-21T13:42:14.5443439Z","tags":{"ai.application.ver":"1.0.0.0","ai.cloud.roleInstance":"001-TBL-1086","ai.operation.id":"9f5866b6dade774bb0edc404aaa34ab0","ai.operation.parentId":"ef1c8ab28c87c843","ai.internal.sdkVersion":"rdddsc:2.13.1-12554","ai.internal.nodeName":"001-TBL-1086.supermix.com.br"},"data":{"baseType":"RemoteDependencyData","baseData":{"ver":2,"name":"POST /api/public/v1.0/createRequestLog","id":"b1742e19d1e13c49","data":"https://api.kisslog.net/api/public/v1.0/createRequestLog","duration":"00:00:00.2502000","resultCode":"400","success":false,"type":"Http","target":"api.kisslog.net","properties":{"DeveloperMode":"true","_MS.ProcessedByMetricExtractors":"(Name:'Dependencies', Ver:'1.1')","AspNetCoreEnvironment":"loc"}}}}
'KissLog' 2021-01-21T13:42:14Z [Error] POST https://api.kisslog.net/api/public/v1.0/createRequestLog 400 ERROR
Invalid parameters

image

In the request without Authorize Atribute
image

The fisical log
2021-01-21.log

from kisslog.sdk.

catalingavan avatar catalingavan commented on September 6, 2024

Thanks. Please trigger the request again WITH the Authorization attribute on (making it fail)

from kisslog.sdk.

danielts90 avatar danielts90 commented on September 6, 2024

Done
image

from kisslog.sdk.

catalingavan avatar catalingavan commented on September 6, 2024

Can you please try few more times? This time it should work

from kisslog.sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.