开发者

Debugging Information

I开发者_如何学Go have a windows service that runs in the background and transfers files from one database to another, and i was wondering what the best way to log/store information about this service so i can debug it in the event of a failure. Currently I'm just using nlog to output exception text and status lines, but is there any information that is usually included in log files?


I think the best practice is to write to the Windows Event EventLog


You can include whatever is helpful to you to figure out what has gone wrong. I like to log to the Event Logs but I see a lot of people choosing to log to databases and xml/text files. I am working on a project where I work that is very large and developed over many iterations and expansions and changed hands several times now. Logging is a mess IMHO because each module logs to its own location in a different format and a very few actually use the event logs (the only ones we can reliable get debugging information from when something goes wrong). Give yourself a way to turn logging up and down so you can log more information sometimes and less others without recompiling. We use a logging level attribute in the config file and based on that we decide what to log and what not.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜