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 Baron Schwartz <ba...@sequent.org> on 2005/02/26 20:36:57 UTC
Logging truncates the file at noon
Hi,
I've searched Google and the Eyebrowse for this and can't find anything
relevant (EyeBrowse seems to have a lot of issues -- about half the links
I click on just lead to a stacktrace). I'm not sure if this is an issue
with log4net or my configuration. Any pointers are much appreciated.
Problem: my log files are rolled daily, but every day at noon the existing
data is blanked out of the log (the file is truncated). The effect is
that when I look at yesterday's file, I only see information for yesterday
after noon, not before noon. I have actually watched this happen; the
first statement that writes to the file after noon truncates everything
already in the file.
My version: 1.2.0.30714. I'm on Windows, MS.NET Framework v1.1.4322 using
Visual Studio 2003 and linking to the pre-built DLL from SourceForge.
Sample of my App.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<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>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="FileAppender" />
</root>
</log4net>
AW: separate log info from a particular method
Posted by Eduard Ralph <e....@mphasis.biz>.
Hi,
I won't dig out the manuals to write a config but this should be pretty
close to what you would have to write:
log4net>
<appender name="AAppender" type="Appender.RollingFileAppender">
<file value="A.TXT" />
<appendToFile value="false" />
<!-- A1 uses PatternLayout -->
<layout type="Layout.PatternLayout">
<conversionPattern value="[%d] %p %c %x - %m%n" />
</layout>
</appender>
<appender name="BAppender" type="Appender.RollingFileAppender">
<file value="B.TXT" />
<appendToFile value="false" />
<!-- B1 uses PatternLayout -->
<layout type="Layout.PatternLayout">
<conversionPattern value="[%d] %p %c %x - %m%n" />
</layout>
</appender>
<root>
<level value="ERROR" />
<appender-ref ref="AAppender" />
</root>
<logger name="A">
<appender-ref ref="AAppender" />
</logger>
<logger name="B">
<appender-ref ref="BAppender" />
</logger>
</log4net>
Eddie
-----Ursprüngliche Nachricht-----
Von: Cheng [mailto:chenghf@gmail.com]
Gesendet: Montag, 28. Februar 2005 18:15
An: Log4NET User
Betreff: separate log info from a particular method
Hi,
I am using RollingFileAppender for my whole application. Suppose the
main logfile is A.txt. I want to log all information from a particular
method to a separate file say B.txt (these log should not be logged to
A.txt). StringMatchFilter filter should be work, however the
particular method has to log a particular string in order to use the
StringMatchFilter fileter. Is there any other convenient way to
archieve this? Ideally just add some config settings.
thanks
separate log info from a particular method
Posted by Cheng <ch...@gmail.com>.
Hi,
I am using RollingFileAppender for my whole application. Suppose the
main logfile is A.txt. I want to log all information from a particular
method to a separate file say B.txt (these log should not be logged to
A.txt). StringMatchFilter filter should be work, however the
particular method has to log a particular string in order to use the
StringMatchFilter fileter. Is there any other convenient way to
archieve this? Ideally just add some config settings.
thanks
Re: Logging truncates the file at noon
Posted by Baron Schwartz <ba...@sequent.org>.
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 Eric Means <er...@gmail.com>.
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:
> Hi,
>
> I've searched Google and the Eyebrowse for this and can't find anything
> relevant (EyeBrowse seems to have a lot of issues -- about half the links
> I click on just lead to a stacktrace). I'm not sure if this is an issue
> with log4net or my configuration. Any pointers are much appreciated.
>
> Problem: my log files are rolled daily, but every day at noon the existing
> data is blanked out of the log (the file is truncated). The effect is
> that when I look at yesterday's file, I only see information for yesterday
> after noon, not before noon. I have actually watched this happen; the
> first statement that writes to the file after noon truncates everything
> already in the file.
>
> My version: 1.2.0.30714. I'm on Windows, MS.NET Framework v1.1.4322 using
> Visual Studio 2003 and linking to the pre-built DLL from SourceForge.
>
> Sample of my App.config file:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <configSections>
> <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
> </configSections>
> <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>
> </appender>
> <root>
> <level value="INFO" />
> <appender-ref ref="FileAppender" />
> </root>
> </log4net>
>
>
--
Eric Means
eric.means@gmail.com
http://www.randomtree.org/eric/
Re: Logging truncates the file at noon
Posted by Marc Hoffmann <ma...@yahoo.com>.
Hi Baron:
I am using the RollingFileAppender as well, and don't have any issues. The only thing I could see
with your configuration that is different than mine is the datePattern parameter that you are
using. Here is my configuration for the RollingFileAppender, which seems to roll over at midnight
and does not truncate. I also use a filter, but that should not make a difference.
<appender name="DEBUGRollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\\Scratch\\SOW\\WfStatusTrackingClient\\DEBUG.log" />
<appendToFile value="true" />
<datePattern value="yyyyMMdd" />
<rollingStyle value="Date" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d{yyyy-MM-dd HH:mm:ss,fff} %-5p - [%t] %c: %m%n" />
</layout>
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="DEBUG" />
</filter>
<filter type="log4net.Filter.DenyAllFilter"/>
</appender>
Marc
--- Baron Schwartz <ba...@sequent.org> wrote:
> Hi,
>
> I've searched Google and the Eyebrowse for this and can't find anything
> relevant (EyeBrowse seems to have a lot of issues -- about half the links
> I click on just lead to a stacktrace). I'm not sure if this is an issue
> with log4net or my configuration. Any pointers are much appreciated.
>
> Problem: my log files are rolled daily, but every day at noon the existing
> data is blanked out of the log (the file is truncated). The effect is
> that when I look at yesterday's file, I only see information for yesterday
> after noon, not before noon. I have actually watched this happen; the
> first statement that writes to the file after noon truncates everything
> already in the file.
>
> My version: 1.2.0.30714. I'm on Windows, MS.NET Framework v1.1.4322 using
> Visual Studio 2003 and linking to the pre-built DLL from SourceForge.
>
> Sample of my App.config file:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <configSections>
> <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
> </configSections>
> <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>
> </appender>
> <root>
> <level value="INFO" />
> <appender-ref ref="FileAppender" />
> </root>
> </log4net>
>
>