Log file advice?
-
I'm writing a program that allows users to send commands to various serial devices. Most of the commands are "Button" orientated. By that I mean they press a button and everything is done for them; however I have a textbox that allows them to type in manual commands should there be something I don't have a button for that they really want to happen. I'm thinking about logging what commands they are typing in order to improve my program so that I can add other buttons that will help make life easier all. I'm wondering if there's a way to do that possibly on Github so that I can retrieve basically over web. Or if there's a better way to do it? I'm currently working in Csharp/WPF. I'm also thinking about logging some try/catch handler errors, so that I can analyze software bugs too, but I'm not too bothered about that right now.
-
I'm writing a program that allows users to send commands to various serial devices. Most of the commands are "Button" orientated. By that I mean they press a button and everything is done for them; however I have a textbox that allows them to type in manual commands should there be something I don't have a button for that they really want to happen. I'm thinking about logging what commands they are typing in order to improve my program so that I can add other buttons that will help make life easier all. I'm wondering if there's a way to do that possibly on Github so that I can retrieve basically over web. Or if there's a better way to do it? I'm currently working in Csharp/WPF. I'm also thinking about logging some try/catch handler errors, so that I can analyze software bugs too, but I'm not too bothered about that right now.
First of course be aware of your user base. You are collecting information about them by doing that and there might be customer relation problems with that. And legal ones as well. Other than that all your are doing is collecting data remotely from an application. There are many ways to do that.
geomeo123 wrote:
if there's a way to do that possibly on Github
As in that there is a library for that? Or that you want the data stored on Github? For the first I am certain there is. As for the second that wouldn't be my choice.
geomeo123 wrote:
thinking about logging some try/catch handler errors
You should create a code API that logs the following - location. File/method. - Text that describes what it is - Additional information. This would be where you put exceptions, including stack traces. Then you call that where ever you want. There are specific libraries that provide 'logging'. In C# I have used log4net and Nlog. That provides the API that I mentioned ready to go. It does not however provide the 'destination'. I know you can find addins to log to databases. I suspect others. Another problem you will have is that since your application is remoting pushing data then someone might do something malicious to abuse your system. Basically you need to figure they will attempt this. So at a minimum you need to provide credentials. Although that probably is not enough. You might want to throttle as well so if they hack your app they can't just start blasting away. There are services that provide APIs that collect data also.
-
First of course be aware of your user base. You are collecting information about them by doing that and there might be customer relation problems with that. And legal ones as well. Other than that all your are doing is collecting data remotely from an application. There are many ways to do that.
geomeo123 wrote:
if there's a way to do that possibly on Github
As in that there is a library for that? Or that you want the data stored on Github? For the first I am certain there is. As for the second that wouldn't be my choice.
geomeo123 wrote:
thinking about logging some try/catch handler errors
You should create a code API that logs the following - location. File/method. - Text that describes what it is - Additional information. This would be where you put exceptions, including stack traces. Then you call that where ever you want. There are specific libraries that provide 'logging'. In C# I have used log4net and Nlog. That provides the API that I mentioned ready to go. It does not however provide the 'destination'. I know you can find addins to log to databases. I suspect others. Another problem you will have is that since your application is remoting pushing data then someone might do something malicious to abuse your system. Basically you need to figure they will attempt this. So at a minimum you need to provide credentials. Although that probably is not enough. You might want to throttle as well so if they hack your app they can't just start blasting away. There are services that provide APIs that collect data also.
jschell wrote:
There are many ways to do that
If I may, but you didn't mention what any of them are. I too have been asking myself this question and I'm very interested to know what other people think.
The difficult we do right away... ...the impossible takes slightly longer.
-
jschell wrote:
There are many ways to do that
If I may, but you didn't mention what any of them are. I too have been asking myself this question and I'm very interested to know what other people think.
The difficult we do right away... ...the impossible takes slightly longer.
-
I'm writing a program that allows users to send commands to various serial devices. Most of the commands are "Button" orientated. By that I mean they press a button and everything is done for them; however I have a textbox that allows them to type in manual commands should there be something I don't have a button for that they really want to happen. I'm thinking about logging what commands they are typing in order to improve my program so that I can add other buttons that will help make life easier all. I'm wondering if there's a way to do that possibly on Github so that I can retrieve basically over web. Or if there's a better way to do it? I'm currently working in Csharp/WPF. I'm also thinking about logging some try/catch handler errors, so that I can analyze software bugs too, but I'm not too bothered about that right now.
-
jschell wrote:
There are many ways to do that
If I may, but you didn't mention what any of them are. I too have been asking myself this question and I'm very interested to know what other people think.
The difficult we do right away... ...the impossible takes slightly longer.
Richard Andrew x64 wrote:
but you didn't mention what any of them are.
Some of them: To a SQL Database To a no-SQL Database To an event hub To flat files To a service that collects metrics. To a custom server API. To Syslog To Azure OpenAPI To AWS OpenSearch
-
Have you looked into Log4net Tutorial for .NET Logging: 14 Best Practices and Examples[^]? It may not offer everything you want but is quite popular in the .NET world.
Ah, Log4Net. From the glory days of .NET, as I moved from (work) place to place everyone used it. Seems to have lost favour in the Core world, and been replaced by something more standardised and flexible, but not as to-the-point :( Two line logging, whoever thought that was a good idea?
Regards, Rob Philpott.
-
Ah, Log4Net. From the glory days of .NET, as I moved from (work) place to place everyone used it. Seems to have lost favour in the Core world, and been replaced by something more standardised and flexible, but not as to-the-point :( Two line logging, whoever thought that was a good idea?
Regards, Rob Philpott.