Comments (10)
from kisslog.sdk.
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.
I'm so happy for contribute,
Is the first time that i open a github issue.
from kisslog.sdk.
Hi Daniel,
Can you please share from the Startup.cs file the Configure(IApplicationBuilder app)
method?
from kisslog.sdk.
Yes,
I divided Startup into several classes,
if you need any more, let me know.
from kisslog.sdk.
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);
};
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.
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
In the request without Authorize Atribute
The fisical log
2021-01-21.log
from kisslog.sdk.
Thanks. Please trigger the request again WITH the Authorization attribute on (making it fail)
from kisslog.sdk.
from kisslog.sdk.
Can you please try few more times? This time it should work
from kisslog.sdk.
Related Issues (20)
- Using Kisslog in Custom DLL HOT 4
- Implement Compiler Services on the Log Method HOT 3
- Creating alerts for a group context HOT 1
- is out KissLog.net? HOT 2
- "application/problem+json" Response Content-Type
- Friendly format *.xml files
- Allow anonymous access to KissLog-samples
- Replace Newtonsoft.Json with System.Text.Json HOT 1
- Alert Notification by Email HOT 9
- RequestLogsApiListener: create fallback event when REST fails
- Prevent Preview response body for large files
- RequestLogsApiListener: Ignore certificate errors HOT 1
- logger.SetHttpStatusCode() should work for Console apps (non-web) HOT 1
- MirrorStreamDecorator: Cannot access a closed Stream
- MachineName is null for ConsoleApps
- Response Json and search for a SearchKey HOT 3
- Logging same InnerException throws an error
- kisslog sdk error UnauthorizedAccessException HOT 4
- Logs not showing and some logs showing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kisslog.sdk.