473,388 Members | 1,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

How to write ASP.NET trace message to a file that rotate daily ?

I am new in ASP.net programing. I want to send all trace message to a
file as follow:

<system.diagnostics>
<trace autoflush="true">
<listeners>
<add name="TestTracer"
type="System.Diagnostics.TextWriterTraceListener, System,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="<app root directory>\Asptesttrace.log" />
</listeners>
</trace>
</system.diagnostics>
The problem is that the file will grow infinitely in size. How can I
make the file rotate daily so that a new log file is created every day?

Dec 11 '06 #1
2 9809
Hi,
You will find following URL useful which does exactly what you want:
http://davebost.com/blog/archive/2004/04/30/180.aspx

Thanks and Regards,
manish bafna
"ni**********@lexisnexis.com" wrote:
I am new in ASP.net programing. I want to send all trace message to a
file as follow:

<system.diagnostics>
<trace autoflush="true">
<listeners>
<add name="TestTracer"
type="System.Diagnostics.TextWriterTraceListener, System,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="<app root directory>\Asptesttrace.log" />
</listeners>
</trace>
</system.diagnostics>
The problem is that the file will grow infinitely in size. How can I
make the file rotate daily so that a new log file is created every day?

Dec 11 '06 #2
Hi,
You can also use log4net for this.The URL for log4net website is:
http://logging.apache.org/log4net/

Thanks and Regards,
manish bafna

"ni**********@lexisnexis.com" wrote:
I am new in ASP.net programing. I want to send all trace message to a
file as follow:

<system.diagnostics>
<trace autoflush="true">
<listeners>
<add name="TestTracer"
type="System.Diagnostics.TextWriterTraceListener, System,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="<app root directory>\Asptesttrace.log" />
</listeners>
</trace>
</system.diagnostics>
The problem is that the file will grow infinitely in size. How can I
make the file rotate daily so that a new log file is created every day?

Dec 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andy Fish | last post by:
Hi, I am wanting to put some simple logging into my .net app. The basic features will be that errors get logged to a file and that there will be a configuration flag to enable more detailed...
5
by: Bennett Haselton | last post by:
I've noticed that if you enter the following code in the codebehind page for an .aspx page, it won't compile because the call to Trace.Write() is not valid except in methods of a class derived from...
5
by: guy | last post by:
Where do I get trace output? Trace.Write("Hello World");
1
by: Phil Sandler | last post by:
Hello all, Thanks in advance for any help with this. I am trying to get sample code to run from Michael Russell's excellent article on removing whitespace:...
9
by: Joe Rattz | last post by:
I can't seem to get to trace.axd. I have turned tracing on in web.config. Here is how I currently have i configured: <trace enabled="true" requestLimit="10" pageOutput="false"...
5
by: Brett Romero | last post by:
I have this in an app.config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.diagnostics> <trace autoflush="true" indentsize="2"> <listeners> <add name="myListener"...
3
by: Matthew Warren | last post by:
I have the following piece of code, taken from a bigger module, that even as I was writing I _knew_ there were better ways of doing it, using a parser or somesuch at least, but learning how wasn't...
0
by: Grant Schenck | last post by:
I have an ASP application which uses a COM object I developed. That object uses OutputDebugString as well as writing to a text file to trace internal activity. If I test my ASP page from Visual...
3
by: Simon | last post by:
Hi all, I'm trying to use the Trace class to log messages to a simple text file. I need to be able to provide a custom filename to be used. I've created a TextWriterTraceListener and added it to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.