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 "McCormick, Brian (BMCCORMI)" <BM...@arinc.com> on 2005/04/28 23:03:47 UTC

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

RE: PatternLayout question

Posted by Göran Roseen <go...@roseen.se>.
>From 1.2.0 beta 8 to 1.2.9, there was a change in Log4net that disallows
"C-style" character escapes in the config file. 
So if you are using 1.2.9, you should use standard xml escapes. I am no xml
guru, but I think that your values will be "&#x2" and "&#x3", respectively.

Then, of course, I start to wonder why you need to put these in layout in
the first place... The whole structure of appenders, filters, layout and
stuff, is a powerful infrastructure for "filtering and routing to files
etc.". If you want to, give the guys on this list a shot at helping you with
a simpler solution...

Sincerely,

Göran Roseen


-----Original Message-----
From: McCormick, Brian (BMCCORMI) [mailto:BMCCORMI@arinc.com] 
Sent: den 28 april 2005 23: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