catalingavan / kisslog.sdk Goto Github PK
View Code? Open in Web Editor NEWKissLog is a lightweight and highly customizable logging framework for .NET applications
Home Page: https://kisslog.net
License: Apache License 2.0
KissLog is a lightweight and highly customizable logging framework for .NET applications
Home Page: https://kisslog.net
License: Apache License 2.0
Create a fallback method for whenever the REST requests towards the KissLog server fails.
This can be used to save the payload locally, as text files
I want to be able to run KissLog in a Specific DLL that maybe used in several projects, but want the DLL to have its own identity for logging purposes.
Is there a way to add the Environment Name to the File Formatter, I need to debug some environment related problem, but I need to see in the logs in which environment the app is running.
Create a try-catch-finally handler which will automatically log when a method starts and when it completes.
Usage
public async Task DeleteAsync()
{
ILogger logger = Logger.Factory.Get();;
await logger.TryCatchFinallyAsync("DeleteAlerts", async () =>
{
await DeleteAlertsAsync();
});
await logger.TryCatchFinallyAsync("DeleteRequestLogs", async () =>
{
await DeleteRequestLogsAsync();
});
}
Output
[DEBUG] DeleteAlerts > start
@........ DeleteAlertsAsync() executing
[DEBUG] DeleteAlerts > complete
[DEBUG] DeleteRequestLogs > start
@........ DeleteRequestLogsAsync() executing
[ERROR] System.NullReferenceException: Object reference not set to an instance of an object.
[DEBUG] DeleteRequestLogs > complete
In some scenarios, MemoryStreamDecorator is closed by .NET, but we are still trying to access it.
Thus, it throws ObjectDisposedException
.
System.ObjectDisposedException: Cannot access a closed Stream.
at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at KissLog.MirrorStreamDecorator.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) in C:\Catalin\KissLog-net\KissLog.Sdk\src\KissLog\MirrorStreamDecorator.cs:line 58
at KissLog.MirrorStreamDecorator.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) in C:\Catalin\KissLog-net\KissLog.Sdk\src\KissLog\MirrorStreamDecorator.cs:line 58
at Microsoft.AspNetCore.WebUtilities.HttpResponseStreamWriter.FlushInternalAsync(Boolean flushEncoder)
at Microsoft.AspNetCore.WebUtilities.HttpResponseStreamWriter.WriteAsyncAwaited(String value)
at Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers.ViewBuffer.WriteToAsync(TextWriter writer, HtmlEncoder encoder)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter
Hello peoples!
Is out of service the url - https://kisslog.net/ ?
Regards,
Fernando.
Is it possible to create an alert for a context group? Example: After 5 exceptions detected the system triggers the alert.
Hi!
I'm not receiving the alert email notifications. I dont know if i'm missing something.
I configured the "Smtp" section in KissLog.config from Kisslog.Frontend with the correct infos and created a new alert with the "Email messages" turned on.
I know the alerts are being triggered, because i can see they in the "alerts" section of the application.
It can be a SSL configuration? Because i didn't find anything about how to configure it in documentation.
I'm using the free on-premise KissLog with AspNetCore SDK for a .Net 5.0 WebApi
Logs are persisted, by default, at the end of the HTTP Request.
If we start a background job, the log messages will not be persisted, because the HTTP Request will have already been finished by that time.
Possible quick fix is to update the LocalTextFileListener to write the logs as soon as they are provided.
KissLogApiListener (cloud listener) do needs to be instructed manually to persist the logs.
Task.Factory.StartNew(async () => {
List<Task> tasks = new List<Task>();
foreach (var item in mails)
{
Task task = _emailsService.SendEmailAsync(EmailType.ApplicationCreated, item.Model, item.To, true);
tasks.Add(task);
}
await Task.WhenAll(tasks);
});
Windows server 2022 and iis 10
KissLog.Exceptions.LogStringAsFileException: KissLog: Error when trying to log as file the string with length 498
---> System.UnauthorizedAccessException: Access to the path is denied.
at System.IO.Path.GetTempFileName()
at KissLog.TemporaryFile.GetTempFileName(String extension)
at KissLog.TemporaryFile..ctor(String extension)
at KissLog.TemporaryFile..ctor()
at KissLog.LoggerData.FilesContainer.LogAsFile(String contents, String fileName)
--- End of inner exception stack trace ---
Every log will contains this error
Using Net Core 3.0 There is a new error with kisslog 2.4.0
System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.Internal.BufferingHelper' from assembly 'Microsoft.AspNetCore.Http, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
at KissLog.AspNetCore.WebRequestPropertiesFactory.ReadInputStream(HttpRequest request)
at KissLog.AspNetCore.WebRequestPropertiesFactory.Create(HttpRequest request)
at KissLog.AspNetCore.KissLogMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Logging two exceptions which have the same inner exception is throwing an error.
var logger = new Logger();
var innerEx = new Exception($"Inner exception: {Guid.NewGuid()}");
logger.Error(new Exception("Exception 1", innerEx));
logger.Error(new Exception("Exception 2", innerEx));
System.ArgumentException:
Item has already been added. Key in dictionary: 'KissLog-ExceptionLogged-2f21ed7d-09e6-47e2-b0ad-3b1172e79581'
Registering the NLogTargetListener the following way
// NLog listener
config.Listeners.Add(new NLogTargetListener()
{
ShouldWriteBeginRequestEvent = (KissLog.Web.HttpRequest httpRequest) => true,
ShouldWriteFlushEvent = (KissLog.FlushArgs.FlushLogArgs args) => true,
Parser = new MyCustomParser()
});
results in KissLog flushing every single message into NLog, ignoring the custom parser:
2019-10-14 16:29:09.4802 [GET /]
2019-10-14 16:29:10.3469 AuthenticationHandler started.
2019-10-14 16:29:10.3679 Swagger request. No authentication context established.
2019-10-14 16:29:11.9607 [301 MovedPermanently][GET /] Duration: 2,246ms
2019-10-14 16:29:12.0635 [GET /swagger/ui/index]
2019-10-14 16:29:12.1023 AuthenticationHandler started.
2019-10-14 16:29:12.1323 Swagger request. No authentication context established.
2019-10-14 16:29:12.6863 [GET /swagger/ui/css/typography-css]
2019-10-14 16:29:12.7531 AuthenticationHandler started.
2019-10-14 16:29:12.7840 Swagger request. No authentication context established.
2019-10-14 16:29:12.8040 [GET /swagger/ui/css/reset-css]
Need to update the Response Content-Type with more values:
{
"Content-Type": "application/problem+json; charset=utf-8"
}
We should allow for providing the values on KissLogConfiguration.Options
KissLogConfiguration.Options
.SetLogResponseBodyContentTypes(() =>
{
return new string[] { "application/json", "application/problem+json" };
});
private void Log(LogLevel logLevel, string message, [CallerMemberName] string memberName = "", [CallerLineNumber] int lineNumber = 0, [CallerFilePath] string memberType = "")
{
_logger.Log(logLevel, message, memberName, lineNumber, memberType);
}
This way if the Calling Member or the line number is left blank it will be pre-filled by the compiler.
When logging arguments which contains loop reference properties, the JSON serializer crashes.
This usually happens when logging Entity Framework entities.
I am implementing kisslog in an API that I am developing and I am having a problem that I cannot say if it is a bug or if it is a problem with my implementations.
The problem is that when a controller method uses the Authorize attribute, the physical log is generated but the request is not listed on the dashboard.
I'm having problems trying to visualize the json response, I'm using Kisslog on-premises , the installation tutorial was followed: https://kisslog.net/Docs/on-premises.installation-guide.html
Everything is working, but I can't perform filters or view the response, I'm interested in buying a license, but how do I solve this problem so that I can finish my tests?
Problem demo: https://mega.nz/file/8xY2EByL#mOyUIcc4KVd_YHxF9911VNwl5coNbTtDWp9KwvqMdcM
I'm using windows server with all software in its latest version today.
Hi folks, is there any documentation to generate data for Users Tab?
I'm coding in ASP NET CORE 3.0 + Identity + JWT. And my tab always display "There are no users captured for XXXXX".
I'm testing Kisslog in develop environment (https://localhost). Could this cause the problem?
Tks
It would be cool to allow following to setup KissLog
app.UseKissLogMiddleware(builder =>
{
builder.Listeners.Add(new KissLogApiListener(new Application(_conf["KissLog:OrganizationId"], _conf["KissLog:ApplicationId"])));
builder.Options.ShouldLogResponseBody((listener, args, arg3) => args.WebRequestProperties.Response.HttpStatusCode >= HttpStatusCode.BadRequest);
});
For now I have the following workaround:
public static class IApplicationBuilderExtensions
{
public class KissLogHelper
{
public Options Options => KissLogConfiguration.Options;
public List<ILogListener> Listeners => KissLogConfiguration.Listeners;
}
public static IApplicationBuilder UseKissLogMiddleware(this IApplicationBuilder app, Action<KissLogHelper> configure)
{
var builder = app.UseKissLogMiddleware();
configure(new KissLogHelper());
return builder;
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.