问题
Situtation
I have a FEZ Cobra II NET running test code. It sends data every second to a server on the LAN. The server writes the data to a text file. After 27 hours and 97,200 successful sends, the Cobra stops sending. Clearly I am not going to debug for 27 hours, and I am not sure how else to trouble shoot, because standard software trouble shooting approaches do not apply.
Question
- If I were to write to log errors on the Cobra, how would I access them?
- Does NETMF have application logs? How can we access them?
- Is there an event viewer?
- What other trouble shooting / debugging steps are viable here?
Code
public class Program
{
private static Timer timer;
private Network network;
public static void Main()
{
Program p = new Program();
p.network = new Network();
p.RepeatedlySendDataToWcfService();
Thread.Sleep(Timeout.Infinite);
}
private void RepeatedlySendDataToWcfService()
{
Program.timer =
new Timer(this.TimerCallback_SendSbcData, new object(), 0, 1000);
}
private void TimerCallback_SendSbcData(object stateInfo)
{
SbcData data = new SbcData();
this.network.Send(data);
}
}
Search and Research
- https://stackoverflow.com/search?q=netmf+troubleshooting No results.
- https://stackoverflow.com/search?q=netmf+error+log No results.
- https://stackoverflow.com/search?q=netmf+remoting No results.
- Can we access Cobra II error logs?
- NETMF - Debugging Applications
回答1:
As the Fez has a memory card slot, you could log send errors to that:
private void TimerCallback_SendSbcData(object stateInfo)
{
try
{
SbcData data = new SbcData();
this.network.Send(data);
}
catch (Exception ex)
{
MyLogToCardMethod(ex.ToString());
}
}
Mounting the card instructions are on the manufacturer site:
https://www.ghielectronics.com/docs/51/netmf-file-system
来源:https://stackoverflow.com/questions/22946632/how-do-we-trouble-shoot-a-long-running-netmf-program-that-stops-in-production