File tree Expand file tree Collapse file tree 1 file changed +24
-20
lines changed Expand file tree Collapse file tree 1 file changed +24
-20
lines changed Original file line number Diff line number Diff line change @@ -580,26 +580,30 @@ void
580
580
log4cplus::pattern::MDCPatternConverter::convert (tstring & result,
581
581
const spi::InternalLoggingEvent& event)
582
582
{
583
- if (!key.empty ())
584
- {
585
- result = event.getMDC (key);
586
- }
587
- else
588
- {
589
- result = LOG4CPLUS_TEXT (" " );
590
-
591
- MappedDiagnosticContextMap mdcMap = event.getMDCCopy ();
592
-
593
- for ( MappedDiagnosticContextMap::const_iterator it = mdcMap.begin (); it != mdcMap.end (); it ++)
594
- {
595
- tstring name (it->first );
596
-
597
- tstring value (it->second );
598
-
599
- result += LOG4CPLUS_TEXT (" {" ) + name + LOG4CPLUS_TEXT (" , " ) + value + LOG4CPLUS_TEXT (" }" );
600
-
601
- }
602
- }
583
+ if (!key.empty ())
584
+ {
585
+ result = event.getMDC (key);
586
+ }
587
+ else
588
+ {
589
+ result.clear ();
590
+
591
+ MappedDiagnosticContextMap const & mdcMap = event.getMDCCopy ();
592
+
593
+ for (MappedDiagnosticContextMap::const_iterator it = mdcMap.begin ();
594
+ it != mdcMap.end (); ++it)
595
+ {
596
+ tstring const & name (it->first );
597
+ tstring const & value (it->second );
598
+
599
+ result += LOG4CPLUS_TEXT (" {" );
600
+ result += name;
601
+ result += LOG4CPLUS_TEXT (" , " );
602
+ result += value;
603
+ result += LOG4CPLUS_TEXT (" }" );
604
+
605
+ }
606
+ }
603
607
}
604
608
605
609
You can’t perform that action at this time.
0 commit comments