hmmm... I could have sworn I got something like this working in a logger I
wrote for a different company... The solution would have had to be really
simple because I didn't know JS about L4N (not that my knowledge of L4N has
changed really...) and just used the default config info from one of the
examples - not including this one modification.

Anyway, thanks once again Ron!

Russ

-----Original Message-----
From: Ron Grabowski [mailto:[EMAIL PROTECTED]
Sent: 15-Jun-05 11:39 AM
To: Log4NET User
Subject: Re: Date Time in Header Footer


You could write your own pattern converter to expose the a DateTime
object:

<header type="log4net.Util.PatternString">
 <converter>
  <name value="dateTimeNow" />
  <type value="Company.Project.Logging.DateTimePatternConverter,
Company.Project" />
 </converter>
 <conversionPattern value="[BEGIN LOGGING AT %dateTimeNow{hh:mm}]%n" />
</header>

I agree that that's a lot of code for just wanting to print out the
current date and time :-/

Perhaps a built-in pattern called %now could be added that accepts a
DateTime format:

 %now{d}
 %now{hh:mm:ss}

- Ron

--- Russell Haley <[EMAIL PROTECTED]> wrote:

> I'm trying ot insert the date and time in the header footer blocks of
> my
> log. I did a search on the mailing list but didn't find anything.
>
> I have tried %d, %date and \d without any success.
>
>  <param name="Header" value="[BEGIN LOGGING AT \d]\r\n" />
>  <param name="Footer" value="[END LOGGING AT \d]\r\n" />
>
> Suggestions?
>
> Thanks!
>
> Russ
>
>

Reply via email to