How can we add a a daily trace listener

Discussion in 'ASP .Net' started by ShayHk, Dec 23, 2013.

  1. ShayHk

    ShayHk Guest

    i add on the web.config
    <configuration>
    <system.diagnostics>
    <trace autoflush="false" indentsize="4">
    <listeners>
    <add name="myListener"
    type="System.Diagnostics.TextWriterTraceListener"
    initializeData="aaa.log" />
    <remove name="Default" />
    </listeners>
    </trace>
    </system.diagnostics>
    </configuration>

    i want it to be a daily file trace
    aaa_20130101.txt
    aaa_20130102.txt
    .....

    how can i do it?
     
    ShayHk, Dec 23, 2013
    #1
    1. Advertising

  2. ShayHk

    Arne Vajhøj Guest

    On 12/23/2013 9:48 AM, ShayHk wrote:
    > i add on the web.config
    > <configuration>
    > <system.diagnostics>
    > <trace autoflush="false" indentsize="4">
    > <listeners>
    > <add name="myListener"
    > type="System.Diagnostics.TextWriterTraceListener"
    > initializeData="aaa.log" />
    > <remove name="Default" />
    > </listeners>
    > </trace>
    > </system.diagnostics>
    > </configuration>
    >
    > i want it to be a daily file trace
    > aaa_20130101.txt
    > aaa_20130102.txt
    > ....
    >
    > how can i do it?


    Maybe it is time to drop trace and switch to a real logging
    framework - they come with features like this.

    Example: log4net has RollingFileAppender for this.

    Arne
     
    Arne Vajhøj, Dec 25, 2013
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rukmal Fernando
    Replies:
    4
    Views:
    885
    Richard Grimes [MVP]
    Oct 27, 2003
  2. Matthias S.
    Replies:
    1
    Views:
    676
    Daniel Fisher\(lennybacon\)
    Nov 30, 2005
  3. Jiho Han
    Replies:
    0
    Views:
    547
    Jiho Han
    Aug 22, 2006
  4. Replies:
    2
    Views:
    2,302
    =?Utf-8?B?TWFuaXNoIEJhZm5h?=
    Dec 11, 2006
  5. Rukmal Fernando

    Trace: Can anyone suggest a good tool to catch trace messages?

    Rukmal Fernando, Oct 10, 2003, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    316
    Richard Grimes [MVP]
    Oct 27, 2003
Loading...

Share This Page