nlog

ASP.NET Core使用Elasticsearch记录NLog日志

六月ゝ 毕业季﹏ 提交于 2019-11-30 12:21:53
原文: ASP.NET Core使用Elasticsearch记录NLog日志 ASP.NET Core使用Elasticsearch记录NLog日志 1、新建一个 ASP.NET Core项目 2、安装Nuge包 运行: Install-Package NLog.Web.AspNetCore 运行: Install-Package NLog 运行: Install-package NLog.Targets.ElasticSearch 3、编写NLog配置文件(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" internalLogToConsole="true"> <extensions> <add assembly="NLog.Targets.ElasticSearch"/> </extensions> ​ <targets> <target name="ElasticSearch" xsi:type="ElasticSearch" ConnectionStringName="http:/

QQ 机器人SDK Newbe.Mahua 2.2 可用性修复

天涯浪子 提交于 2019-11-30 11:24:01
版本亮点 可用性修复 修复了以下平台近期由于平台更新导致 SDK 不可用的问题: CQP CleverQQ 虽说该版本是一个次要更新版本,但实际上现在版本在这两个平台上已经完全失效,必须升级为最新版本。 下载了源码的开发者,可以根据最新提交的代码 diff 来修正自己项目 优化 Installer 安装速度 在国内仍然有开发者反映依赖于 nuget 的模板下载安装速度不快。 因此,我们将最新的项目模板所需要的文件都进行了“离线化”处理,使得下载过程更加流畅。 由于有初学开发者无法区别“下载HTML”和“下载脚本”的区别,因此,我们制作了打包下载的方式托管于码云上。 点击此处查看Installer压缩包 升级方法与要点 使用命令行在机器人exe根目录运行以下命令 mahua InstallMahua 注意:升级过程将会覆盖以下配置文件,若开发者有自行定制过这些配置项,需要先自行备份: mahua.json NLog.config 本篇文章由一文多发平台 ArtiPub 自动发布 来源: https://my.oschina.net/newbe36524/blog/3110503

How to create new log file for each application run

三世轮回 提交于 2019-11-30 11:14:24
As the title implies how can I create a new log file for each application run ? I know how to do it for minute/hour/etc. but not for app. run There is what I have for now: target name="Debug" archiveEvery="Hour" archiveFileName="${basedir}/logs/Debug.{#####}.txt" maxArchiveFiles="4" archiveNumbering="Sequence" xsi:type="File" fileName="${basedir}/logs/Debug.txt" layout="${date:format=HH\:mm\:ss} | ${level} | ${message} ${exception} ${exception:format=stacktrace}" But actually I dont need to archive every hour, what I want is to archive every time when I run my app. There is what I found in old

How do you log errors (Exceptions) in your ASP.NET apps?

假如想象 提交于 2019-11-30 10:22:36
问题 I'm looking for the best way to log errors in an ASP.NET application. I want to be able to receive emails when errors occurs in my application, with detailed information about the Exception and the current Request. In my company we used to have our own ErrorMailer, catching everything in the Global.asax Application_Error. It was "Ok" but not very flexible nor configurable. We switched recently to NLog. It's much more configurable, we can define different targets for the errors, filter them,

Add, enable and disable NLog loggers programmatically

老子叫甜甜 提交于 2019-11-30 08:25:59
How can I add, edit, delete, enable, and disable loggers from code for NLog? To add: var logTarget = new ... logTarget.Layout = "Your layout format here"; // e.g. "${logger}: ${message} ${exception:format=tostring}"; // specify what gets logged to the above target var loggingRule = new LoggingRule("*", LogLevel.Debug, logTarget); // add target and rule to configuration LogManager.Configuration.AddTarget("targetName", logTarget); LogManager.Configuration.LoggingRules.Add(loggingRule); LogManager.Configuration.Reload(); Removal is done with LogManager.Configuration.LoggingRules.Remove

NLog doen't work on IIS

走远了吗. 提交于 2019-11-30 06:04:09
问题 I added NLog to my project. Following the instructions I created NLog.config. <?xml version="1.0" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <targets> <target name="file" xsi:type="File" layout="${longdate} ${logger} ${message}" fileName="${basedir}/${shortdate}.log" /> </targets> <rules> <logger name="*" minlevel="Debug" writeTo="file" /> </rules> </nlog> and then just log something. var logger = LogManager

JAVA数据结构与算法(三)、排序算法

泄露秘密 提交于 2019-11-30 05:15:20
排序算法 排 序也称排序算法 (Sort Algorithm ) , 排序是将 一 组 数据,依指定的顺序进行排 列 的 过程。 排 序的分类: 1) 内 部排序 :指将需要处理的所有数据都加 载 到 内部存储器中进行排序。 2 ) 外部排序法:数据量过大,无法全部加载到 内 存 中,需要借助外部存储进 行排序 。 3) 常见的排序算法分类 ( 见 右图): l 算法的时间复杂度 度 量一个程 序 ( 算法 ) 执 行时 间 的 两 种方法 1) 事 后统计的方 法 这种方法可 行 , 但 是有两个 问题 : 一是要想对设计的算法的运行性能进行评测 , 需要 实 际运 行该程序; 二是所得时间的统计量依赖于计算机的硬件、软件等环境因 素 , 这种方式,要在同一台计算机的相同状态下运行,才能比较哪个算法 速 度更快 。 2) 事前估 算的方 法 通过分析某个算法的 时间复杂度 来判断哪个算法更优 . 时 间频 度 时 间频 度 :一 个算法花费的时间与算法中语句的执行次数成正比例,哪个算法中语句执行次数多,它花费时间就多。 一个算法中的语句执行次数称为语句频度或时间频度 。记为 T(n) 。 举 例说明 - 基本案例 比 如 计 算 1-100 所有数字之 和 , 我们设计两种算法: T(n)=n+1; T(n)=1; 举例说明 - 忽略常数项 T(n)=2n+20 T(n)=2*n

How can I use a RichTextBox as a NLog Target in a WPF application?

无人久伴 提交于 2019-11-30 04:47:58
问题 I read the following posts but neither helped to just get the same efficient way of printing logs from NLog onto a RichTextBox control target as in Winforms. How can I use NLog's RichTextBox Target in WPF application? WPF: Binding RichTextBox to Logger Output I also browsed the official forum but with no success (except suggestions to read the two above posts). The idea would be to add the target as: <target xsi:type="RichTextBox" name="console" layout="${longdate:useUTC=true}|${level

.Net Core WebApi(3)—NLog

好久不见. 提交于 2019-11-30 04:32:48
原文: .Net Core WebApi(3)—NLog 在.Net Core中,微软提供的内置的日志组件没有实现将日志记录到文件、数据库上。 这里使用NLog替代内置的日志组件 1.在项目中引入NuGet包   NLog NLog.Web.AspNetCor ⒉在项目的根目录中创建NLog配置文件 右击项目“ 添加 ”->"Web配置文件"->新建“ nlog.config ” 1 <?xml version="1.0" encoding="utf-8" ?> 2 <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 autoReload="true" 5 internalLogLevel="Warn" 6 internalLogFile="internal-nlog.txt"> 7 <!-- 要写入的目标 --> 8 <targets> 9 <!--将日志写入到文件中--> 10 <target xsi:type="File" name="allfile" fileName="logs/all/nlog-all-${shortdate}.log" 11 layout="${longdate}|$

Where is ${basedir} located, using NLog?

半城伤御伤魂 提交于 2019-11-30 00:16:36
问题 Unless I'm totally missing it, I'm under the impression that the NLog documentation uses ${basedir} in its examples, without explaining what its location is supposed to be. Where can I find information that lists all possible options with a meaningful description? I have this configuration defined: <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true"> <targets> <target name="file" xsi:type="File" layout="$