Which is "better":
- Build e-mail notifications for important events (critical problems and stuff) into my application (a socket server).
- 开发者_如何学CBuild/use a log analyzer to look into each line of the application log checking for some conditions and firing up a script to send emails.
If the second is "better", which tools can I use to do this.
I would just use log4net, which includes an SmtpAppender.
It comes with many different appenders so you can very easily configure it to ie. dump all info messages to file, warnings and errors to database and send an email notification for errors only.
You can change the configuration without any changes to the source code.
I honestly write my own email notification systems. It's actually useful to learn how to do this, in addition you could write part of your app to check the log as well and do the "best of both worlds" by doing immediately email notification of major events (of which you can use an email notification model of code that you can reuse multiple times, which is the end result of any project right? :) i.e. to write code that can be reused in other realms of your project).
The short version: Both. Just my suggestion.
精彩评论