Henry K. created LOG4NET-523:
--------------------------------

             Summary: .NET message parameter corrupted if dynamic-string
                 Key: LOG4NET-523
                 URL: https://issues.apache.org/jira/browse/LOG4NET-523
             Project: Log4net
          Issue Type: Bug
            Reporter: Henry K.
            Priority: Trivial


In .NET C# log4net creates line to log file, but line gets corrupted after 
attempting to enter message data with type that is {code}dynamic { string } 
{code}

More details:
{noformat}
conversionPattern value="%date [%thread] %-5level %logger::%sourceClass - 
%message%newline" />
{noformat}
-- in place where [ %message ] -is found, everything after that will be 
removed. Applying next log line to same row.

Example:
{code:java}
// extra conversion is unnecessary, serializer method should return string... 

var data = Convert.ToString(JsonConvert.Serialize(dynamicData)); 
// data = type[ dynamic{string} ]
log.Debug(data);
{code}
{noformat}
2016-08-11 23:00:00,000 [69] DEBUG MyNamespace::RootClass.Subclass.Method() - 
Some debug data
2016-08-11 23:00:09,999 [69] DEBUG MyNamespace::RootClass.Subclass.Method() - 
Some debug data
...
{noformat}
-->
{noformat}
2016-08-11 23:00:00,000 [69] DEBUG MyNamespace::2016-08-11 23:00:09,999 [69] 
DEBUG MyNamespace::RootClass.Subclass.Method() - {some dynamic data converted 
to JSON string}
...
{noformat}

This is of course "fixable" or possible to round it by casting that data type 
to string:
{code:java}
// extra conversion is unnecessary, serializer method should return string... 
// data = type[ string ]
var data = (string)Convert.ToString(JsonConvert.Serialize(dynamicData));
log.Debug(data);
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to