سؤال

I have implemented into my C# project Log4Net logging features.

Right now I'm using EventLogAppender to log all the errors, but I want to know if the FIleAppender is a better approach. I have my concerns about performance when saving to a file instead of logging into system events.

What are the benefits of using FileAppender vs EventLogAppender?

هل كانت مفيدة؟

المحلول

Performance wise, both are fast, but I suspect File based will be faster. If you are writing so many logs that this is a concern, then your program sounds pretty "chatty" and so I would go with the FileAppender--system logs are nice when logs are concise and occasional, but they quickly get tedious if they are long and/or frequent. File based logs are generally easier to archive, if that's a concern. EventLogs, on the other hand, are nice if you are already monitoring the event logs or if you want to put everything in a "standard" place--that is, the user will always know where to look.

Note that you don't have to choose just one or the other--you can do your short/occasional status updates in the event log and details in the file log--that's the approach I usually take.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top