tags:

views:

152

answers:

1

I used Logger class in my application for catching the error and logging events. But at the time of writing the log to the text pad, it returns one exception like this

 Microsoft.Practices.ObjectBuilder2.BuildFailedException was unhandled by user code
  Message="The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter, null]) failed: The device is not ready.\r\n (Strategy type ConfiguredObjectStrategy, index 2)"

My code for writing the log is:

 public static void Log(string Message)
    {
        LogEntry log = new LogEntry();
        log.TimeStamp = DateTime.Now;
        log.Title = "Exception Logging";
        log.Categories.Add("Category");
        log.Message = Message.ToString();
        Logger.Write(log);
    }

Please help for resolving this issue..

+5  A: 

I would guess from the error, that this logger is trying to write to a file.

The file path is probably pointing to an empty CD/DVD drive, or a removable drive that has been ejected or something like that.

Can you verify the device the logger is trying to write to?

Rob Levine