public void TestStackTracePattern() { var p = new PatternParser(GetLoggingEvent()); var s = p.Parse("%stacktrace{6}"); Assert.AreEqual("log4net.Layout.LayoutSkeleton.Format > log4net.Layout.PatternLayout.Format > log4net.Util.PatternConverter.Format > log4net.Layout.Pattern.PatternLayoutConverter.Convert > log4net.Layout.Pattern.StackTracePatternConverter.Convert > log4net.Core.LoggingEvent.get_LocationInformation", s); }
public void TestMessageAsNamePattern() { var loggingEvent = GetLoggingEvent(); var p = new PatternParser(loggingEvent); p.AddConverter("message-as-name", typeof(MessageAsNamePatternConverter)); var s = p.Parse("%message-as-name{-2}"); Assert.AreEqual("Tw/o", s, "%message-as-name not registered"); }
protected override void ParseProperties(PatternParser patternParser) { _parsedQueueName = string.IsNullOrEmpty(_queueName) ? null : patternParser.Parse(_queueName); _parsedDelaySeconds = string.IsNullOrEmpty(_delaySeconds) ? (int?)null : Convert.ToInt32(patternParser.Parse(_delaySeconds)); _parsedMessage = string.IsNullOrEmpty(_message) ? null : patternParser.Parse(_message); }
protected string PreProcess(LoggingEvent loggingEvent, string renderedString) { var patternParser = new PatternParser(loggingEvent); if (renderedString.Contains("%")) { renderedString = patternParser.Parse(renderedString); } LogLog.Debug(GetType(), string.Format("RenderedString: {0}", renderedString)); if (_dirtyParsedProperties) { ParseProperties(patternParser); if ( !loggingEvent.Properties.GetKeys() .Any(key => key.StartsWith("IsqsAppender.MetaData.") && key.EndsWith(".Error"))) { _dirtyParsedProperties = false; } } return(renderedString); }
protected abstract void ParseProperties(PatternParser patternParser);