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 "Ron Grabowski (JIRA)" <ji...@apache.org> on 2005/06/15 15:22:52 UTC

[jira] Created: (LOG4NET-34) Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"

Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
--------------------------------------------------------------------------------------------------------

         Key: LOG4NET-34
         URL: http://issues.apache.org/jira/browse/LOG4NET-34
     Project: Log4net
        Type: Improvement
    Reporter: Ron Grabowski
    Priority: Trivial
 Attachments: XmlHierarchyConfigurator.cs.patch

Currently values for xml config nodes must be passed in via the value attribute:

 <conversionPattern value="%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n" />

Why isn't this syntax supported?

 <conversionPattern>%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n</conversionPattern>

If the above syntax were supported, a possible solution to this question:

 http://www.mail-archive.com/log4net-user%40logging.apache.org/msg01791.html

would be:

 <conversionPattern>
  <![CDATA[<header>%n <date>%d</date>%n <user>%u</user>%n <info>%m</info>%n</header>%n]]>
 </conversionPattern>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (LOG4NET-34) Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"

Posted by "Nicko Cadell (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/LOG4NET-34?page=all ]
     
Nicko Cadell resolved LOG4NET-34:
---------------------------------

    Fix Version: 1.2.10
     Resolution: Fixed

I have applied the patch with mods and all is well

> Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
> --------------------------------------------------------------------------------------------------------
>
>          Key: LOG4NET-34
>          URL: http://issues.apache.org/jira/browse/LOG4NET-34
>      Project: Log4net
>         Type: Improvement
>     Reporter: Ron Grabowski
>     Priority: Trivial
>      Fix For: 1.2.10
>  Attachments: XmlHierarchyConfigurator.cs.patch
>
> Currently values for xml config nodes must be passed in via the value attribute:
>  <conversionPattern value="%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n" />
> Why isn't this syntax supported?
>  <conversionPattern>%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n</conversionPattern>
> If the above syntax were supported, a possible solution to this question:
>  http://www.mail-archive.com/log4net-user%40logging.apache.org/msg01791.html
> would be:
>  <conversionPattern>
>   <![CDATA[<header>%n <date>%d</date>%n <user>%u</user>%n <info>%m</info>%n</header>%n]]>
>  </conversionPattern>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (LOG4NET-34) Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"

Posted by "Nicko Cadell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LOG4NET-34?page=comments#action_12313844 ] 

Nicko Cadell commented on LOG4NET-34:
-------------------------------------

Multiple CDATA sections will be concatenated together on a single line. Empty text nodes will be ignored (by the parser).

To embed a tab in the config file you need to use the XML numberic character reference &#9;

> Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
> --------------------------------------------------------------------------------------------------------
>
>          Key: LOG4NET-34
>          URL: http://issues.apache.org/jira/browse/LOG4NET-34
>      Project: Log4net
>         Type: Improvement
>     Reporter: Ron Grabowski
>     Priority: Trivial
>      Fix For: 1.2.10
>  Attachments: XmlHierarchyConfigurator.cs.patch
>
> Currently values for xml config nodes must be passed in via the value attribute:
>  <conversionPattern value="%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n" />
> Why isn't this syntax supported?
>  <conversionPattern>%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n</conversionPattern>
> If the above syntax were supported, a possible solution to this question:
>  http://www.mail-archive.com/log4net-user%40logging.apache.org/msg01791.html
> would be:
>  <conversionPattern>
>   <![CDATA[<header>%n <date>%d</date>%n <user>%u</user>%n <info>%m</info>%n</header>%n]]>
>  </conversionPattern>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (LOG4NET-34) Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"

Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/LOG4NET-34?page=all ]

Ron Grabowski updated LOG4NET-34:
---------------------------------

    Attachment: XmlHierarchyConfigurator.cs.patch

If a value attribute is not found, loop through the child node to find the first CDATA or Text node and use its InnerText as the value.

> Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
> --------------------------------------------------------------------------------------------------------
>
>          Key: LOG4NET-34
>          URL: http://issues.apache.org/jira/browse/LOG4NET-34
>      Project: Log4net
>         Type: Improvement
>     Reporter: Ron Grabowski
>     Priority: Trivial
>  Attachments: XmlHierarchyConfigurator.cs.patch
>
> Currently values for xml config nodes must be passed in via the value attribute:
>  <conversionPattern value="%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n" />
> Why isn't this syntax supported?
>  <conversionPattern>%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n</conversionPattern>
> If the above syntax were supported, a possible solution to this question:
>  http://www.mail-archive.com/log4net-user%40logging.apache.org/msg01791.html
> would be:
>  <conversionPattern>
>   <![CDATA[<header>%n <date>%d</date>%n <user>%u</user>%n <info>%m</info>%n</header>%n]]>
>  </conversionPattern>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (LOG4NET-34) Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"

Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LOG4NET-34?page=comments#action_12313724 ] 

Ron Grabowski commented on LOG4NET-34:
--------------------------------------

The code actually takes the first text or CDATA. That allows a comment to come before the text. 

Another general benefit of being able to use CDATA is that you don't have squeeze potentially long marksup all on one line:

<conversionPattern>
 <!-- Hello World -->
<![CDATA[
<header>
 <date>
  <hour>
    %d{h}
  </hour>
 </date>
 <user>
 %u
 </user>
 <info>
 %m
 </info>
</header>
]]> 
</conversionPattern>

I quicklyt tried inserting tabs into the layout using \t, \\t, and '\t' but they always rendered as a literal. I didn't see a %tab pattern or a %space{5} pattern.

If the text were concatenated, would this appear on one line in the output file?

<conversionPattern>
 <!-- this text is ignored -->
 <![CDATA[%m ]]> 
 <!-- this text is ignored -->
 <![CDATA[%d ]]> 
 <!-- this text is ignored -->
 <![CDATA[%n ]]> 
</conversionPattern>

It looks a little messy but I can think of some cases where it could be useful. Especially with describing custom patterns.

> Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
> --------------------------------------------------------------------------------------------------------
>
>          Key: LOG4NET-34
>          URL: http://issues.apache.org/jira/browse/LOG4NET-34
>      Project: Log4net
>         Type: Improvement
>     Reporter: Ron Grabowski
>     Priority: Trivial
>  Attachments: XmlHierarchyConfigurator.cs.patch
>
> Currently values for xml config nodes must be passed in via the value attribute:
>  <conversionPattern value="%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n" />
> Why isn't this syntax supported?
>  <conversionPattern>%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n</conversionPattern>
> If the above syntax were supported, a possible solution to this question:
>  http://www.mail-archive.com/log4net-user%40logging.apache.org/msg01791.html
> would be:
>  <conversionPattern>
>   <![CDATA[<header>%n <date>%d</date>%n <user>%u</user>%n <info>%m</info>%n</header>%n]]>
>  </conversionPattern>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (LOG4NET-34) Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"

Posted by "Nicko Cadell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LOG4NET-34?page=comments#action_12313723 ] 

Nicko Cadell commented on LOG4NET-34:
-------------------------------------

It is possible to embed < and > in the current attribute value, just escape using &lt; and &gt;

I will have a look at the impact of your patch and see if it can be easily integraged - on first look it looks ok. I think we should probably concatenate any text or CDATA node text rather than taking the last one, but apart from that it looks ok.

> Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
> --------------------------------------------------------------------------------------------------------
>
>          Key: LOG4NET-34
>          URL: http://issues.apache.org/jira/browse/LOG4NET-34
>      Project: Log4net
>         Type: Improvement
>     Reporter: Ron Grabowski
>     Priority: Trivial
>  Attachments: XmlHierarchyConfigurator.cs.patch
>
> Currently values for xml config nodes must be passed in via the value attribute:
>  <conversionPattern value="%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n" />
> Why isn't this syntax supported?
>  <conversionPattern>%5p %d{yyyy-MM-dd hh:mm:ss tt} (%c:%L) - %m%n</conversionPattern>
> If the above syntax were supported, a possible solution to this question:
>  http://www.mail-archive.com/log4net-user%40logging.apache.org/msg01791.html
> would be:
>  <conversionPattern>
>   <![CDATA[<header>%n <date>%d</date>%n <user>%u</user>%n <info>%m</info>%n</header>%n]]>
>  </conversionPattern>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira