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/03/06 21:20:57 UTC

RE: Logging truncates the file at noon

Due to a fix in CVS for config string parsing the backslashes in the
date pattern should no longer be escaped. Previously we required C style
escaping of strings, however this is incorrect as XML escaping is what
is actually required.

The DateTime.ToString method supports sing quote escaping of string
literals as well as slash escaping of individual characters, you may
want to try the following config as I think it is more readable:

<appender name="DateRollingFileAppender"
type="log4net.Appender.RollingFileAppender">
  <file value="rolling-log-" />
  <appendToFile value="true" />
  <datePattern value="yyyy-MM-dd'.txt'" />
  <rollingStyle value="Date" />
  <staticLogFileName value="false" />
  <layout type="log4net.Layout.PatternLayout" 
     value="%-5level %-20thread %date %logger line %line%n %message%n"
/>
</appender> 

Nicko

> -----Original Message-----
> From: Baron Schwartz [mailto:baron@sequent.org] 
> Sent: 28 February 2005 13:51
> To: Log4NET User; Eric Means
> Subject: Re: Logging truncates the file at noon
> 
> Thanks Eric.  I pulled code from CVS and built it.  Now I'm 
> seeing my log files, instead of being
> 
> log-2005-02-27.txt
> log-2005-02-28.txt
> 
> They are now
> 
> log-2005-02-27\Ax\A
> log-2005-02-27\Px\P
> log-2005-02-28\Ax\A
> log-2005-02-28\Px\P
> 
> Not what I want :-P  Is there some change in my configuration 
> that I need to get the old behavior?  I'm not seeing any 
> changes in the file doc/release/config-examples.html under 
> the RollingFileAppender section, so it looks like this may be 
> an effect I'm suffering from using the bleeding edge.
> 
> 
> On Sun, 27 Feb 2005, Eric Means wrote:
> 
> > Baron, we had hit this exact same problem; the response I 
> got at the 
> > time was that this was a known bug in the 1.2.0 beta 8 
> version.  Using 
> > a more recent (CVS) version resolved the issue (using the 
> same config 
> > file).
> >
> > On Sat, 26 Feb 2005 14:36:57 -0500 (Eastern Standard Time), Baron 
> > Schwartz <ba...@sequent.org> wrote:
> > >
> > > Sample of my App.config file:
> > >
> > >     <log4net>
> > >         <appender name="FileAppender"
> > > type="log4net.Appender.RollingFileAppender">
> > >             <file value="//server/share$/log/log-" />
> > >             <appendToFile value="true" />
> > >             <datePattern value="yyyy-MM-dd.\\tx\\t" />
> > >             <rollingStyle value="Date" />
> > >             <staticLogFileName value="false" />
> > >             <layout type="log4net.Layout.PatternLayout">
> > >                 <conversionPattern value="%-5p %-20t %d 
> %c line %L%n 
> > > %m%n" />
> > >             </layout>
> 

RE: Logging truncates the file at noon

Posted by Baron Schwartz <ba...@sequent.org>.
Thanks to everyone who replied.  Building from CVS, and escaping with
single quotes as below, solved the problem.  Incidentally, is there a
roadmap to release a newer version of the dll to sourceforge for download?
What features/bugs/etc are holding that back?

Thanks
Baron

-- 
Everyone who believes in telekinesis, raise my hand!

On Sun, 6 Mar 2005, Nicko Cadell wrote:

> Due to a fix in CVS for config string parsing the backslashes in the
> date pattern should no longer be escaped. Previously we required C style
> escaping of strings, however this is incorrect as XML escaping is what
> is actually required.
>
> The DateTime.ToString method supports sing quote escaping of string
> literals as well as slash escaping of individual characters, you may
> want to try the following config as I think it is more readable:
>
> <appender name="DateRollingFileAppender"
> type="log4net.Appender.RollingFileAppender">
>   <file value="rolling-log-" />
>   <appendToFile value="true" />
>   <datePattern value="yyyy-MM-dd'.txt'" />
>   <rollingStyle value="Date" />
>   <staticLogFileName value="false" />
>   <layout type="log4net.Layout.PatternLayout"
>      value="%-5level %-20thread %date %logger line %line%n %message%n"
> />
> </appender>
>
> Nicko
>
> > -----Original Message-----
> > From: Baron Schwartz [mailto:baron@sequent.org]
> > Sent: 28 February 2005 13:51
> > To: Log4NET User; Eric Means
> > Subject: Re: Logging truncates the file at noon
> >
> > Thanks Eric.  I pulled code from CVS and built it.  Now I'm
> > seeing my log files, instead of being
> >
> > log-2005-02-27.txt
> > log-2005-02-28.txt
> >
> > They are now
> >
> > log-2005-02-27\Ax\A
> > log-2005-02-27\Px\P
> > log-2005-02-28\Ax\A
> > log-2005-02-28\Px\P
> >
> > Not what I want :-P  Is there some change in my configuration
> > that I need to get the old behavior?  I'm not seeing any
> > changes in the file doc/release/config-examples.html under
> > the RollingFileAppender section, so it looks like this may be
> > an effect I'm suffering from using the bleeding edge.
> >
> >
> > On Sun, 27 Feb 2005, Eric Means wrote:
> >
> > > Baron, we had hit this exact same problem; the response I
> > got at the
> > > time was that this was a known bug in the 1.2.0 beta 8
> > version.  Using
> > > a more recent (CVS) version resolved the issue (using the
> > same config
> > > file).
> > >
> > > On Sat, 26 Feb 2005 14:36:57 -0500 (Eastern Standard Time), Baron
> > > Schwartz <ba...@sequent.org> wrote:
> > > >
> > > > Sample of my App.config file:
> > > >
> > > >     <log4net>
> > > >         <appender name="FileAppender"
> > > > type="log4net.Appender.RollingFileAppender">
> > > >             <file value="//server/share$/log/log-" />
> > > >             <appendToFile value="true" />
> > > >             <datePattern value="yyyy-MM-dd.\\tx\\t" />
> > > >             <rollingStyle value="Date" />
> > > >             <staticLogFileName value="false" />
> > > >             <layout type="log4net.Layout.PatternLayout">
> > > >                 <conversionPattern value="%-5p %-20t %d
> > %c line %L%n
> > > > %m%n" />
> > > >             </layout>
> >
>
>