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 "eryw456f2345t (JIRA)" <ji...@apache.org> on 2014/03/07 15:24:42 UTC

[jira] [Commented] (LOG4NET-426) Support IFormattable when write message and add option regional parameters

    [ https://issues.apache.org/jira/browse/LOG4NET-426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13923901#comment-13923901 ] 

eryw456f2345t commented on LOG4NET-426:
---------------------------------------

Is it possible to add to the class log4net.ObjectRenderer.DefaultRenderer call IFormattable.ToString(string, IFormatProvider)?

IFormattable formattable = obj as IFormattable;
string str = formattable != null ? formattable.ToString(null, writer.FormatProvider) : obj.ToString();
writer.Write(str == null ? SystemInfo.NullText : str);

instead

string str = obj.ToString();
writer.Write(str == null ? SystemInfo.NullText : str);

> Support IFormattable when write message and add option regional parameters
> --------------------------------------------------------------------------
>
>                 Key: LOG4NET-426
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-426
>             Project: Log4net
>          Issue Type: Improvement
>            Reporter: eryw456f2345t
>            Priority: Minor
>
> (1) Add option regional parameters to config (class CultureInfo) by analogy with Encoding. CultureInfo.InvariantCulture not always perfect.
> (2) Support inteface IFormattable when write message.
> If my_iformattable_message implements IFormattable when invoking log.Info(my_iformattable_message); use not ToString() method, but IFormattable.ToString(string format, IFormatProvider formatProvider) and pass a parameter formatProvider from log4net. Invocation ToString() use CultureInfo.CurrentCulture.



--
This message was sent by Atlassian JIRA
(v6.2#6252)