|
Those who voted for "I don't log errors in my apps" must really hate themselves. Or, at the very least, I would hate working with their code.
OTOH, there is such a thing as an unreadable log file. Logging is like commenting - you need to be smart about it. Too much of it and it just gets in the way, and you start wishing it wasn't there at all.
|
|
|
|
|
|
Is this an advertisement for https://errlog.io?
I do not fear of failure. I fear of giving up out of frustration.
|
|
|
|
|
The BugTrap library mentioned at codeproject (and now on GitHub) is excellent for recording and logging crashes.
See:
<a href="https://www.codeproject.com/Articles/14618/Catch-All-Bugs-with-BugTrap">Catch All Bugs with BugTrap!</a>[<a href="https://www.codeproject.com/Articles/14618/Catch-All-Bugs-with-BugTrap" target="_blank" title="New Window">^</a>]
Also, see:
<a href="https://github.com/bchavez/BugTrap">GitHub - bchavez/BugTrap: BugTrap: Catch unhandled exceptions in unmanaged and managed .NET code.</a>[<a href="https://github.com/bchavez/BugTrap" target="_blank" title="New Window">^</a>]
For other things (non-crashes) I log to file generally
|
|
|
|
|
As a freelancer I'd always done some basic logging of all the apps I developed. Then a client - later to become a very significant client for me - asked me to take on support of his main line-of-business application. I installed some basic logging / reporting and discovered about 20% of transactions were failing! (The nature of the app meant that potential customers had no incentive / method to report failures). He had no idea of the scale of the problems which were losing him £ks per week. From there I enhanced the logging and developed a standard logging routine that I've included in all web applications / sites since. Serious errors trigger an email to me so I can often fix an error before the client is aware.
Someone above says they rely on the user taking a screenshot of error message etc. All very well but this doesn't trap environmental info (e.g. cookies, browser config, IP address, session contents etc.. etc..) which can make a vital difference when it comes to debugging.
I log to database (with a failover to flatfile if d/b is unavailable) which makes querying/filtering much easier to extract stats / spot trends etc..
|
|
|
|
|
I started on the PDP-11 and wrote mostly batch processing systems.
Logs were all we had. We used a character prefix for Error,Warning,or Informational.
My first PC apps did not log, but as complexity grew under windows, we started logging.
We also found OutputDebugString() (ODS), and used that with our logging if an environment variable was set, so we could catch the details.
The hardest thing was log rotation (because we did fill a few hard disks over many years)...
The last place I was at did not do logging until I got there, they look back and wonder about the lost hours they wasted looking into issues... Because we see them now. Very easily.
Don't like working without the logs!
|
|
|
|
|
Kirk 10389821 wrote: PDP-11 ... Error,Warning,or Informational I know developers who cannot distinguish between error levels. And of course, their logs usually look like azc 30 error 191 - absolutely useful information when you have to fix something.
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
|
|
|
|
|
One place I worked logged all errors to a disk file.
Including "Disk Full"
They also moved the cursor off the screen, some VP was offended by the blinking cursor at startup, so errors were not visible then either.
Psychosis at 10
Film at 11
Those who do not remember the past, are doomed to repeat it.
Those who do not remember the past, cannot build upon it.
|
|
|
|
|
I just log to stderr and stdout. Every logging software I've used a can read that easily. It's not my applications job to specify where the logs end up.
|
|
|
|
|
That's what the bug tracker is used for, right?
|
|
|
|
|
But in the rare occasions that they do - I log the error to a file, using an API that allows us to filter types and severities of errors that will be logged.
Using the O/S' error logging mechanism is a problem - clients can't easily send you the log.
Using 3rd-party error logging is also a problem - most clients don't want their stuff on the cloud.
That leaves various local options, which all translate to writing stuff to a file.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
We are using Serilog with Seq, I found Serilog to be a very good option compared to log4net or other.
|
|
|
|
|
Our desktop applications have no need for keeping error logs. The error is reported to the end user who either sends me a screenshot or calls to report it.
Web applications, either self-hosted or cloud, create their own error logs. There are a few 'exceptions' where very specific errors are logged to a custom database table.
Since I'm mostly monitoring IIS (ftp/w3) log files, I naturally built my own log file viewer.
"Go forth into the source" - Neal Morse
|
|
|
|
|
kmoorevs wrote: Since I'm mostly monitoring IIS (ftp/w3) log files, I naturally built my own log file viewer. Open source?
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
- Popup a message box on the server
- Have a camera recording live video of the screen
- Video streamed to the cloud
- AI service on cloud looks for possible pop-ups in video stream
- When a pop-up is detected, the text is OCR'd out of the frame
- The text is printed out
- An IOT robot picks up the print-out, and puts it into an envelop
- A human employee takes this envelop and ships it via 1 day FedEx to the developer
- Developer receives it next day, and timely debugging ensues
|
|
|
|
|
Come to think about it, this is the only way to log errors, true or not.
|
|
|
|
|
Absolutely, and you and I get it because of our vast experience with that sort of advanced logging!
|
|
|
|
|
Nish Nishant wrote: A human employee takes this envelop and ships it via 1 day FedEx to the developer
In order to save money, I recommend only high level errors be sent with one day shipping.
|
|
|
|
|
So, you would suggest 2 day for non-priority logs?
|
|
|
|
|
First class is the cheapest and takes at least three days.
|
|
|
|
|
Nish Nishant wrote: Have a camera recording live video of the screen
You should have another video stream for keyboard and mouse input
My plan is to live forever ... so far so good
|
|
|
|
|
|
We do the same thing.
Hogan
|
|
|
|
|
I did write something that we now use in all of our applications that used log4net to write to various outputs (file, database, console). Have just switched to NLog as it appears to be the fastest and most reliable.
Benchmarking 5 Popular .NET Logging Libraries[^]
Keep your friends close. Keep Kill your enemies closer.
The End
|
|
|
|
|
I prefer NLog to be honest, but I have to use log4net currently, as that is what the project I am working on has been using.
|
|
|
|