saurav
saurav

Reputation: 5926

Event Logging in Windows 8.1 application

I want to implement logging framework in my windows 8.1 application and also am new to windows 8.1 Which will have the property of appending and rolling over when certain size of the file is reached.

In Windows 8.1 I found two options but also found very little documentation and info about which to use and when.

Microsoft recommendation is to use FileLoggingSession as mentioned in this build video. http://channel9.msdn.com/Events/Build/2013/3-136

I have couple of questions on FileLoggingSession

(a) I have done a POC where the logs are only written to disk when I call closeAndSaveToFileAsync() but this is supposed to be a termination/suspension scenario call which closes the file. I would like to have logs even if there are no errors or application termination. When the logs are actually written to disk ? I need more like Logging Session's saveFileAsync()

(b) It is mentioned that when maximum file size is reached. Content from memory is flushed to disk and LogFileGenerated event is called. I could not figure out what is the maximum size of a file. Can it be configured any way ?

Second option I found was using Metro Log https://github.com/mbrit/MetroLog. Though haven't tried it in my application. But seems to have very less documentation and community support.

I would really appreciate if anyone can share his/her experiences with logging in Windows 8.1 application and answer/comment on my questions/understanding above.

Cheers, Saurav

Upvotes: 2

Views: 452

Answers (1)

saurav
saurav

Reputation: 5926

Just to answer what i had decided.

I had decided to use FileLoggingSession APIs provided by Microsoft.

Pros:

  • Dont' have a dependency on any other library/API.

  • Recommended by Microsoft

Cons:

  • File sizes for rolling over can not be configured.

  • A new file is created after every time logs are written to disk. So number of files increase.

cheers,

Saurav

Upvotes: 2

Related Questions