I didn't see that 1.2.9 was out Thanks Nicko! -Scott Wojan
-----Original Message----- From: Nicko Cadell [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 21, 2005 3:17 PM To: Log4NET User Subject: RE: FinalizeConverter in log4net.helpers.PatternParser In log4net 1.2.9 you can add additional patterns to the PatternLayout in the config file: For example you could define a custom pattern that looks up a user's SpecialFolder: <layout type="log4net.Layout.PatternLayout"> <converter> <name value="folder" /> <type value="TestConsoleApp.SpecialFolderPatternConverter,TestConsoleApp" /> </converter> <conversionPattern>%folder{MyMusic}- %message%newline</conversionPattern> </layout> The code for the custom converter is: public class SpecialFolderPatternConverter : log4net.Util.PatternConverter { override protected void Convert(System.IO.TextWriter writer, object state) { Environment.SpecialFolder specialFolder = (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), base.Option, true); writer.Write(Environment.GetFolderPath(specialFolder)); } } If you want to create a subclass of PatternLayout you can add converters directly by calling the AddConverter method from your subclass constructor. Cheers, Nicko > -----Original Message----- > From: Scott Wojan [mailto:[EMAIL PROTECTED] > Sent: 21 June 2005 21:08 > To: [email protected] > Subject: FinalizeConverter in log4net.helpers.PatternParser > > The method: > protected void FinalizeConverter(char c) on line 237 of > ..\src\helpers\PatternParser.cs is not marked as "virtual" so we can't > create custom log formats. > > Version - 1.2.0 beta 8 > > Thanks, > Scott Wojan > ++++++CONFIDENTIALITY NOTICE++++++ > The information in this email may be confidential and/or privileged. > This email is intended to be reviewed by only the individual or > organization named above. If you are not the intended recipient or an > authorized representative of the intended recipient, you are hereby > notified that any review, dissemination or copying of this email and > its attachments, if any, or the information contained herein is > prohibited. If you have received this email in error, please > immediately notify the sender by return email and delete this email > from your system. > ++++++CONFIDENTIALITY NOTICE++++++ The information in this email may be confidential and/or privileged. This email is intended to be reviewed by only the individual or organization named above. If you are not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any review, dissemination or copying of this email and its attachments, if any, or the information contained herein is prohibited. If you have received this email in error, please immediately notify the sender by return email and delete this email from your system.
