You could extend PatternLayout to accept the name of a text file which holds a number indicating where the counter pattern should restart from:
<layout type="Company.Project.Logging.Layout.CountingPatternLayout"> <counterFile="\Logs\CountingPatternLayout.txt" /> <conversionPattern value="%counter %level %date - %message%newline" /> </layout> If the CountingPatternLayout file contained the number 670, %counter would start with the value 671. When the appender is shutdown, the counter file is opened and updated with the new value. --- Damien Heckler <[EMAIL PROTECTED]> wrote: > > Yes, you're right about the fact that if the application restarts, > the line > counter is lost. > > Log4net is so great then I thought it could deal with this kind of > problems > :). > > > Damien. > > > -----Message d'origine----- > De�: Simon Wallis [mailto:[EMAIL PROTECTED] > Envoy�: lundi 6 f�vrier 2006 17:00 > �: Log4NET User > Objet�: Re: Log file line number > > Seems very unlikely, since once the app is restarted how does it know > where > it left off? I used the TextPad text editor, which displays line > numbers on > each line. Other advanced text editors will do the same. > > Simon. > > -----Original message----- > From: "Damien Heckler" [EMAIL PROTECTED] > Date: Mon, 06 Feb 2006 15:03:58 -0800 > To: [email protected] > Subject: Log file line number > > > Hi all, > > > > > > > > Is there a way to configure the conversionPattern to write the > log file > > line number like below ? > > > > > > > > 0 : starting application. > > > > 1 : the second line of my log file > > > > 2 : the third line of my log file > > > > 3 : datadatadata. > > > > . > > > > 100 : stopping application. > > > > > > > > > > > > > > > > Thanks. > > > > > > > > Damien > > > > > >
