Append current Date to Log file with Log4Net

前端 未结 5 650
忘掉有多难
忘掉有多难 2020-12-30 07:26

All I want to do is append the current date and time to my log file, say:

\"export_(Wed_Feb_21_2009_at_1_36_41PM)\"

Here is my current conf

5条回答
  •  鱼传尺愫
    2020-12-30 07:58

    To produce file name like:

    log_2013-12-19.txt
    

    make changes

    
        
        
        
        
    
    

    Please observe param "DatePattern" where .\tx\t makes the file name extension .txt. If you provide .txt instead of .\tx\t, then this would save file name with extension .PxP if the time is PM or .AxA in case of AM. so I used \t to enforce to write character instead of pattern. Time may also be added and what ever time pattern needed.

    So, this may be really what Philipp M wanted.

提交回复
热议问题