@@ -115,45 +115,6 @@ protected override void WriteProperties(IReadOnlyDictionary<string, LogEventProp
115115 output . Write ( "}" ) ;
116116 }
117117
118- /// <summary>
119- /// Escape the name of the Property before calling ElasticSearch
120- /// </summary>
121- protected override void WriteDictionary ( IReadOnlyDictionary < ScalarValue , LogEventPropertyValue > elements , TextWriter output )
122- {
123- var escaped = elements . ToDictionary ( e => DotEscapeFieldName ( e . Key ) , e => e . Value ) ;
124-
125- base . WriteDictionary ( escaped , output ) ;
126- }
127-
128- /// <summary>
129- /// Escape the name of the Property before calling ElasticSearch
130- /// </summary>
131- protected override void WriteJsonProperty ( string name , object value , ref string precedingDelimiter , TextWriter output )
132- {
133- name = DotEscapeFieldName ( name ) ;
134-
135- base . WriteJsonProperty ( name , value , ref precedingDelimiter , output ) ;
136- }
137-
138- /// <summary>
139- /// Escapes Dots in Strings and does nothing to objects
140- /// </summary>
141- protected virtual ScalarValue DotEscapeFieldName ( ScalarValue value )
142- {
143- return value . Value is string s ? new ScalarValue ( DotEscapeFieldName ( s ) ) : value ;
144- }
145-
146- /// <summary>
147- /// Dots are not allowed in Field Names, replaces '.' with '/'
148- /// https://github.com/elastic/elasticsearch/issues/14594
149- /// </summary>
150- protected virtual string DotEscapeFieldName ( string value )
151- {
152- if ( value == null ) return null ;
153-
154- return value . Replace ( '.' , '/' ) ;
155- }
156-
157118 /// <summary>
158119 /// Writes out the attached exception
159120 /// </summary>
@@ -171,15 +132,24 @@ protected override void WriteException(Exception exception, ref string delim, Te
171132
172133 private void WriteExceptionSerializationInfo ( Exception exception , ref string delim , TextWriter output , int depth )
173134 {
174- output . Write ( delim ) ;
175- output . Write ( "{" ) ;
176- delim = "" ;
177- WriteSingleException ( exception , ref delim , output , depth ) ;
178- output . Write ( "}" ) ;
135+ while ( true )
136+ {
137+ output . Write ( delim ) ;
138+ output . Write ( "{" ) ;
139+ delim = "" ;
140+ WriteSingleException ( exception , ref delim , output , depth ) ;
141+ output . Write ( "}" ) ;
179142
180- delim = "," ;
181- if ( exception . InnerException != null && depth < 20 )
182- this . WriteExceptionSerializationInfo ( exception . InnerException , ref delim , output , ++ depth ) ;
143+ delim = "," ;
144+ if ( exception . InnerException != null && depth < 20 )
145+ {
146+ exception = exception . InnerException ;
147+ depth = ++ depth ;
148+ continue ;
149+ }
150+
151+ break ;
152+ }
183153 }
184154
185155 /// <summary>
0 commit comments