You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2020/04/04 22:29:03 UTC
[jira] [Updated] (LOG4NET-216) Write a simple option parser for
pattern converters
[ https://issues.apache.org/jira/browse/LOG4NET-216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ralph Goers updated LOG4NET-216:
--------------------------------
LOG4NET is now dormant.
> Write a simple option parser for pattern converters
> ---------------------------------------------------
>
> Key: LOG4NET-216
> URL: https://issues.apache.org/jira/browse/LOG4NET-216
> Project: Log4net
> Issue Type: New Feature
> Components: Other
> Affects Versions: 1.2.11
> Reporter: Ron Grabowski
> Priority: Minor
> Fix For: 1.2/2.0 Maintenance Release
>
>
> There isn't a standard way of passing in more than just a single value into pattern converters:
> %logger{2}
> Create a simple parser that can split out the Option string:
> public class RepeatConverter : PatternConverter
> {
> protected override void Convert(TextWriter writer, object state)
> {
> SimpleOptionParser optionParser = new SimpleOptionParser(Option);
> char character = optionParser.GetChar("Character");
> int repeat = optionParser.GetInt("Repeat", 1); // defaults to 1
> writer.Write(new String(character, repeat));
> }
> }
> Where the pattern might look something like this in the config file:
> %repeat{Character:a,Repeat,10}
> that would be translated into:
> aaaaaaaaaa
> Are there more established ways of encoding multiple values in a string?
> %repeat{character:a;repeat:10}
> %repeat{character=a:char,repeat=10:int}
> ???
> Maybe this will allow the next next version of log4net to support nested patterns...
--
This message was sent by Atlassian Jira
(v8.3.4#803005)