nlog

Memory leak - why too many “Ichangetoken” objects

好久不见. 提交于 2019-12-24 22:23:53
问题 Above is the screenshot when compared to baseline of memory dump. I have an api method, which I'm calling every 3 seconds and nothing else is going on in the environment like, no user using the environment. When I debug in VS2017, for each request that I make, I it is calling some services like "addtransient","addscopped" etc. and in the startup file we are configuring different config files return builder.AddDataEngineFile(s => { s.FileProvider = provider; s.Path = path; s.Optional =

Data from web Application not getting passed to ElasticSearch

限于喜欢 提交于 2019-12-24 21:34:39
问题 We have a .Net web application and we were already logging to csv file. We just started logging with Elastic search. I am able to see a log on Kibana but none of the information from application added to LogEventInfo is visible here though I can see that contentLength is changed based on length of information sent. I can only see http details in Kibana for each log. Can you let me know what could be the issue. Configuration looks like <target name="elastic" xsi:type="BufferingWrapper"

NLog get messages in C#

﹥>﹥吖頭↗ 提交于 2019-12-24 11:44:57
问题 I am recently using Nlog in an ASP.Net project for a client with good success. I need to connect to an existing application that has its own event log management and provide them with a copy of my log information. Is there any way to get the strings that I provided to Nlog using any of the log functions? Example: logger.Info("My info"); logger.Debug("My debug"); logger.Error("My error"); logger.Warn("My warn"); List<string> messages = logger.getStrings() <-- this is what I need How I can get

NLog include EventId in log file

巧了我就是萌 提交于 2019-12-24 10:03:16
问题 The ILogger in .NETCore 2.2 has a EventId parameter. public static void LogError(this ILogger logger, EventId eventId, string message, params object[] args); How can I get NLog to output this to the log file? My nlog.config: <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true"> <extensions> <add assembly="NLog.Web.AspNetCore"/> </extensions> <targets> <target xsi:type="File"

NLog how to access RequestId?

随声附和 提交于 2019-12-24 07:58:12
问题 I want to save Activity.Current?.Id ?? HttpContext.TraceIdentifier into database, because that is Request Id which user see in default error view. But how ? HttpContext is not available in startup.cs and i tried access HttpContext in LayoutRenderer not successfully. Error method in HomeController public IActionResult Error() { var model = new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }; return View(model); } I tried LayoutRenderer namespace Copacking.Web

ASP.NET Core ---日志

这一生的挚爱 提交于 2019-12-24 07:02:08
一、日志记录: 1、日志的作用: 程序中记录日志一般有两个目的,故障定位和显示程序运行状态。好的日志记录方式可以提供足够多定位问题的依据。 2、日志的等级: 有良好工作习惯的人,工作的时候会将领导交待下来的工作分为:紧急重要、重要不紧急、紧急不重要、不紧急不重要等;同样 ASP.NET Core 定义了以下日志级别(按严重性从低到高排列)。 每次写入日志时都需指定其 LogLevel。 日志级别指示严重性或重要程度。 例如,如果方法正常结束则写入 Information 日志,如果方法返回 404 返回代码则写入 Warning 日志,如果捕获未知异常则写入 Error 日志。 可以使用日志级别控制写入到特定存储介质或显示窗口的日志输出量。 例如在生产中,可将所有 Information 及以下级别的日志放在卷数据存储,将所有 Warning 及以上级别的日志放在值数据存储。 在开发期间,通常要将严重性为 Warning 或以上级别的日志发送到控制台。 需要进行故障排除时,可添加 Debug 级别。 Trace = 0 表示仅对于开发人员调试问题有价值的信息。 这些消息可能包含敏感应用程序数据,因此不得在生产环境中启用它们。 默认情况下禁用。 示例:Credentials: {"User":"someuser", "Password":"P@ssword"} Debug = 1

NLog and Unit Testing

被刻印的时光 ゝ 提交于 2019-12-24 04:51:29
问题 I am using NLog for my logger. Everything works fine when logging when I run an .exe, or even debug through Visual Studio, NLog will still write to the file. But, if I run an object that calls the logger through a Unit test, the file is created but it is empty. Is there an extra setting/rule I need to add to the config to have NLog write to files under unit tests? I could mock NLog for this and not have log dumps, but I'd like to see if I can get this to work before I decide to just mock NLog

Nlog with MongoDB connection and target

南楼画角 提交于 2019-12-24 04:16:06
问题 I am trying to use a logger that will log into MongoDB, but I can not get it to work. In the same configuration i have set up the loggers to log using an email and file and both work just fine. Here is my NLog.config file <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <extensions> <add assembly="NLog.MongoDB"/> </extensions> <!-- See http://nlog-project.org/wiki/Configuration_file for

Where to configure NLog NHibernate bridge for logging sql configuration?

穿精又带淫゛_ 提交于 2019-12-24 03:58:08
问题 As a proof-of-concept I am using a console application wrapping a proxy of a WCF service. I execute a few calls through the proxy and write the results to the console. Underlying the WCF service is a Data Access Layer built on the Repository pattern using NHibernate as an ORM. I want to write the NHib-generated SQL to the console. I have attempted to configure NLog using the NuGet package and guidance from here with no luck, but I suspect perhaps I don't properly understand where I need to

How to wrap each function in project?

◇◆丶佛笑我妖孽 提交于 2019-12-24 01:54:12
问题 I have tons of functions in my WinForms project and i'm using NLog for logging. I want to have an ability to wrap each function with nlogger.Info("start") and nlogger.Info("end") so i will know in which place actual exception occurred or where the code currently runs. Is there a smart way to do it or i will need to place lines from above in all of my functions ? 回答1: I believe that PostSharp can do this for you, and can apply at the assembly level (via assembly-level attributes). However, I