- エラーロギングコードが失敗した場合はどうしますか?
- 現在機能していることをどのように確認しますか?
- それが機能していないかどうかをどうやって知るのですか?
- 実稼働環境での動作をどのようにテストしますか?
- 他のすべてが失敗した場合、例外をスローする必要がありますか?
以下のコードは、Microsoftのエンタープライズライブラリロギングアプリケーションブロックを使用しています。どうやってそれを「より良く」するのですか?
using Microsoft.Practices.EnterpriseLibrary.Logging;
class Program
{
static void Main(string[] args)
{
try
{
// Trying to write some data to the DB
...
}
catch (Exception ex)
{
LogHelper.LogException(ex, "Trying to write to the DB");
}
}
}
public class LogHelper
{
public static void LogException(Exception ex, string exceptionType)
{
try
{
// Simplified version, only logging the message
Logger.Write(exceptionType);
}
catch
{
// What do you do here???
}
}
}