Is there a way to get Log4net to work on Windows Phone 7?
I'm a huge fan of the Apache Log4Net, and have been using it forever. I'm at a lo开发者_JAVA百科ss bringing this logging power to Windows Phone 7.
Have you / Can you accomplish this?
How?
If there's a Silverlight version of Log4Net then that should be able to work on Windows Phone 7. You have to keep in mind that 100% of your network I/O off of Windows Phone 7 will be asynchronous given that the underlying environment is Silverlight, so any of the standard calls for logging to a remote server won't work unless they use the Begin/End Response methods.
This was released recently that you might like to check out as a starting point.
Silverlight and WP7 Exception Handling and Logging building block
This may be a good use for the Silverlight Analytics Framework (http://msaf.codeplex.com/).
Just a guess at this point since I'm starting to put MSAF in an app tonight. I know you can log custom entries in Google Analytics (although I forget the proper term) and hoping MSAF provides that functionality as well.
This doesn't help with log4net, but have you considered NLog? NLog 2.0 is out in beta and is compatible with Silverlight.
http://nlog-project.org/
NLog 2.0 also supports asynchronous logging.
I have not done any WP7 development, so I don't really know what other considerations there are for logging in that environment.
Update: NLog recently announced a beta release for Windows Phone 7.
Good luck.
精彩评论