How do I use a date pattern in a header/footer?

后端 未结 4 684
醉梦人生
醉梦人生 2020-12-28 20:13

Here\'s my appender configuration from my app.config. This just prints out the literal string instead of translating it to the date (i.e., it literally prints \"[START: %d

4条回答
  •  既然无缘
    2020-12-28 20:57

    I encountered this problem and a quick workaround I used is to just use a fixed header and footer. Then do this as soon as you have the ILog object:

    log.Info(string.Format("[START: {0} ]\r\n", dateString))

    So just under the header you will get the information you desire.

    E.g

    ===Start===
    [START:  2012-02-23 12:12:12 ]
    
    logs...
    

提交回复
热议问题