You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Henry K. (JIRA)" <ji...@apache.org> on 2016/08/11 20:50:21 UTC

[jira] [Updated] (LOG4NET-523) .NET message parameter corrupted if dynamic-string

     [ https://issues.apache.org/jira/browse/LOG4NET-523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry K. updated LOG4NET-523:
-----------------------------
    Description: 
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 MyProject::Namespace.ClassName.Method() - Some debug data
2016-08-11 23:00:09,999 [69] DEBUG MyProject::Namespace.ClassName.Method() - Some debug data
...
{noformat}
-->
{noformat}
2016-08-11 23:00:00,000 [69] DEBUG MyProject::2016-08-11 23:00:09,999 [69] DEBUG MyProject::Namespace.ClassName.Method() - {Some debug data}
...
{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}

  was:
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}


> .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 MyProject::Namespace.ClassName.Method() - Some debug data
> 2016-08-11 23:00:09,999 [69] DEBUG MyProject::Namespace.ClassName.Method() - Some debug data
> ...
> {noformat}
> -->
> {noformat}
> 2016-08-11 23:00:00,000 [69] DEBUG MyProject::2016-08-11 23:00:09,999 [69] DEBUG MyProject::Namespace.ClassName.Method() - {Some debug data}
> ...
> {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)