public void OnFlush(FlushLogArgs args) { IEnumerable <LogMessage> logMessages = args.MessagesGroups.SelectMany(p => p.Messages).OrderBy(p => p.DateTime).ToList(); string filePath = _listener.GetFilePath(); string beginRequest = _textFormatter.FormatBeginRequest(args.HttpProperties.Request); string endRequest = _textFormatter.FormatEndRequest(args.HttpProperties.Request, args.HttpProperties.Response); lock (Locker) { using (StreamWriter sw = File.AppendText(filePath)) { if (!string.IsNullOrEmpty(beginRequest)) { sw.WriteLine(beginRequest); } if (!string.IsNullOrEmpty(endRequest)) { sw.WriteLine(endRequest); } foreach (var logMessage in logMessages) { string value = _textFormatter.FormatLogMessage(logMessage); if (!string.IsNullOrEmpty(value)) { sw.WriteLine(value); } } } } }
public void OnBeginRequest(HttpRequest httpRequest) { if (HasKissLogTarget.Value == true) { return; } string content = _textFormatter.FormatBeginRequest(httpRequest); var logger = global::NLog.LogManager.GetLogger(Constants.DefaultLoggerCategoryName); logger.Info(content); }
public void OnBeginRequest(HttpRequest httpRequest, ILogger logger) { if (FlushTrigger == FlushTrigger.OnMessage) { string filePath = GetFileName(_logsDirectoryFullPath); lock (Locker) { using (StreamWriter sw = System.IO.File.AppendText(filePath)) { sw.WriteLine(_textFormatter.FormatBeginRequest(httpRequest)); } } } }
public void OnBeginRequest(HttpRequest httpRequest) { string value = _textFormatter.FormatBeginRequest(httpRequest); if (string.IsNullOrEmpty(value)) { return; } string filePath = _listener.GetFilePath(); lock (Locker) { using (StreamWriter sw = File.AppendText(filePath)) { sw.WriteLine(value); } } }
public void OnBeginRequest(HttpRequest httpRequest, ILogger logger) { if (HasKissLogTarget.Value == true) { return; } if (ShouldWriteBeginRequestEvent(httpRequest) == false) { return; } var nLogLogger = NLog.LogManager.GetLogger(logger.CategoryName); string message = _textFormatter.FormatBeginRequest(httpRequest); if (string.IsNullOrEmpty(message)) { return; } nLogLogger.Info(message); }