You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Nicko Cadell <ni...@neoworks.com> on 2005/05/03 00:54:58 UTC

RE: PatternLayout question

Character literals are specified using standard XML constructs, i.e. as
numeric character references. e.g. &#x1E;

However according to the XML 1.0 recommendation:
http://www.w3.org/TR/REC-xml/#charsets

The valid range of characters is:

#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

Numeric character references are not able to express characters from
outside these ranges. 

That means that &#x2; is not a legal character in XML however it is
expressed.

If you need to use these characters you can write a custom pattern that
will output the characters that you need. For an example of how to write
and use a PatternLayout custom pattern see:

http://marc.theaimsgroup.com/?l=log4net-user&m=110142086820117&w=2

Cheers,

Nicko

> -----Original Message-----
> From: McCormick, Brian (BMCCORMI) [mailto:BMCCORMI@arinc.com] 
> Sent: 28 April 2005 22:04
> To: log4net-user@logging.apache.org
> Subject: PatternLayout question
> 
> I am using a pattern:
> 
> <conversionPattern value="%p %t %c - %m%n"/>
> 
> What I need to do is surround the pattern with a char 0x02 
> and 0x03 so that the messages (which may span multiple lines) 
> can be filtered based on keywords and routed to a file etc. 
> Something like this: 
> <conversionPattern value="\x02%p %t %c - %m%n\x03"/>
> 
> I have tried several ways of encapsulating these such as 
> '\\002' '\\x02'
> '\002' '\x02' etc and nothing seems to work. Is there any way 
> to specify character literals in the format string?
> 
> Thanks.
> 
> 
> Brian McCormick
> Senior Analyst, Engineering
> ARINC Airport Systems Division
> phone: 918-461-3088
> email: bmccormi@arinc.com
> 
>