28 February 2023

Better Logging for the Best Sleep

I enjoy my sleep. An uninterrupted night after completing a coding project and having it deployed into a production environment is some of the best sleep I can have.

Being woken in the middle of the night because my code is failing in production and the support team not knowing the cause is something I have learned over the year to try to address long before my head hits the pillow. My logging should help them understand if the problem is really bad code or really something else such as a network problem or bad data. Well constructed logging can point the spotlight on the right place to look.

I was going through logs of some automation software at work trying to find a flow to the process. I will admit I did not know the package that well, so I was trying to gain an understanding reading through the logs. I've found using an application's logs to be helpful to understanding how it works without taking a class on the software. This got me thinking about how I log my own code. I've been writing log statements for years, but I know I could always improve my own logging skills. The following aspects are a few things I've learned over the years.

Logging is communication

Relationships are always better with good communication. The clearer the communication, the better the relationship. Assumptions can be made when it comes to believing what the code is doing, and we all know what is said about assumptions. In fact, the logical flow one expects might actually be part of the problem which logging could reveal. Being explicit when logging to remove any guesswork will save so much time when troubleshooting. Log clearly and concisely. Get to the point.

Understand the levels

Logging generally has about five levels: Debug, Info, Warning, Error, and Critical. And most loggers allow for customizing these levels or even adding levels among these defaults. Knowing what goes into a general flow of knowledge when reading logs and what belongs at the debug level should be obvious, but it might take a little time to make those judgment calls. At the Info level, I normally want to give more of an overall stepping through the code at points which mark functionality so that a first pass of the logs can help me at least see where in the code it is failing. I will throw in more variables and values into my Debug level statements when I need to see beyond the obvious logic. Warnings are for giving notice of things to not do or things which could be done better. Errors should be obvious as are Critical responses.

Logging is documentation

To be clear, logging does not replace documentation. It is a form of documentation. It goes hand-in-hand with documentation. Instead of explaining how the code functions, it shows how the process flows. It's a real-time walkthrough of the logical execution of the code. It can tell the story of what the program is doing while you watch it play out before you. If you consider it a part of the of the documentation, how you construct the statements might vary a little from what might seem obvious when in the middle of coding.

Another idea is to combine the documentation with the logging. Sometimes it is better to put longer explanations and suggestions for solving in the actual documentation and use custom codes in the logging to direct the support team to text that will give them a better understanding of the causes and outline the solutions to take.

Write for a larger audience

Sawing logs is an expression defining heavy sleeping. But when someone in a support capacity who does not have an intimate knowledge of the code, what they have in the logs can be enough for them to know what is wrong or leave them confused even a little bit which will prompt a next level call to the development team and possibly the developer.

My approach to logging has always been to write it so that no one needs to call me in the middle of the night because they have reached a point where it cannot be solved by them. In most cases, other pieces in the system could be the cause and easily determined with clear logging. When certain common problems have been experiences, adjusting the logs to better pinpoint the place to check and even suggest a course of action can help keep notifications at bay.

Keep it safe

Logging is generally put on a protected file system (or it should be) and/or ingested by a secure logging service, but logging credentials is generally unnecessary. Login ids should be enough to know which credentials are being used. Sometimes connection strings logged as a lump of information. Measures should be taken to mask passwords in those blocks of strings. I've seen functions built to parse that output before it's put out to mask the sensitive information. Knowing again the audience who will view the logs should also be considered for this.

I'm sure more could be said about logging. Clear and thorough logging can keep you sleeping when your code is being reviewed by a support team. Support teams can do their jobs more efficiently and effectively with skilled logging. Developers who will manage projects you leave behind will herald you wise. It should be every developer's goal to become a master at logging.

18 February 2023

More Thought on Dell's Recent Battery Policy

After mulling over the situation for the past couple of days, I have considered another course of action if I want to keep purchasing Dell laptops: When I buy a new laptop, just add two replacement batteries to the cart to keep the life of the laptop going well past the five years they will support them.

This does not mean I am remaining exclusively with Dell has been my practice. Extra batteries from Dell are three times the perfectly good third-party replacements found on Amazon. I will be doing a little more investigation into other companies like Lenovo and HP. If they allow for generic replacement batteries to be used without a BIOS block, then they are definitely a better investment.

I did spend some time yesterday evening disassembling an official Dell battery (which was dead). I thought maybe I could either swap out the actual lithium-ion packs or extract whatever circuitry which identified the units as officially Dell. The batteries are not a something that can be simply disassembled. Neither of those theories were feasible.

16 February 2023

Dell Now Follows Apple's Business Model

This is a sad day for me. I have been a big supporter of Dell computers for years. I have spent a lot of money over the years choosing Dell hardware including some PowerEdge servers. When a few batteries had started reaching the end of their lives, I went to Amazon to purchase replacements. This practice has extended the life of the laptops past their supported time.

But all this changed when purchasing new batteries from Amazon. The batteries are not official Dell batteries and are prohibited from charging because the BIOS does not allow it. I surf over to Dell's site to purchase an official battery, but they do not exist. I cannot get an official Dell battery from Dell. (There is the eBay option, but that's no guarantee of a new battery.)

This is the transcript from the technical support when I inquired about batteries and the policy:

Vidya S (2/16/2023, 8:48:44 AM): Welcome to Dell Out of Warranty Chat Support. My name is Vidya Sehgal.

While I am checking the details, let me also inform you that your chat has landed to paid support queue. 

Vidya S (2/16/2023, 8:49:01 AM): Greetings, Hope you are doing well today! 

Vidya S (2/16/2023, 8:49:37 AM): To confirm, you are contacting us today in regards to the system service tag ******* ? 

Mark (2/16/2023, 8:49:41 AM): Yes 

Vidya S (2/16/2023, 8:50:35 AM): Thank you for confirming. 

Vidya S (2/16/2023, 8:50:43 AM): I regret the inconvenience this issue has caused and assure you that I will try my best to resolve the issue to your satisfaction. 

Mark (2/16/2023, 8:51:02 AM): I have purchased third-party batteries for this and other Dell laptops I own to extend their life. But for some reason, the BIOS no longer recognizes these batteries informing me to purchase official Dell batteries. I come ot the site to do that and cannot find official Dell batteries to purchase. 

Mark (2/16/2023, 8:51:37 AM): Is there no way to get these other batteries to be accepted since Dell can no longer provide what they  require? 

Vidya S (2/16/2023, 8:51:38 AM): Okay! 

Vidya S (2/16/2023, 8:52:33 AM): No! They won't work. 

Mark (2/16/2023, 8:52:51 AM): And there is no provided batteries from Dell anymore? 

Mark (2/16/2023, 8:53:13 AM): *are no 

Vidya S (2/16/2023, 8:53:30 AM): Let me check the part availability. 

Vidya S (2/16/2023, 8:54:38 AM): Part is not available. 

Tanuj S (2/16/2023, 8:55:15 AM): Welcome to Dell Out of Warranty Chat Support. My name is Tanuj Sharma.

While I am checking the details, let me also inform you that your chat has landed to paid support queue. 

Tanuj S (2/16/2023, 8:55:29 AM): Greetings, Hope you are doing well today! 

Tanuj S (2/16/2023, 8:55:45 AM): To confirm, you are contacting us today in regards to the system service tag ******* ? 

Mark (2/16/2023, 8:56:09 AM): Yes 

Tanuj S (2/16/2023, 8:56:26 AM): I can see you have mentioned issues with battery, correct ? 

Mark (2/16/2023, 8:56:58 AM): Since Dell cannot provide the part and third-party batteries are not supported, I have no options to continue using my laptops other than power cord, correct? 

Mark (2/16/2023, 8:58:26 AM): This seems like an Apple approach to business: Only allow use for the supported time and then force new purchases every few years. I'm not a fan of this. 

Tanuj S (2/16/2023, 8:59:22 AM): Unfortunately the part is not available. It is not possible for us to procure parts after certain point of time as the technology advances, the old products gets obsolete from the market. 

Tanuj S (2/16/2023, 9:00:39 AM): I understand how frustrating it is, but the parts can only be procured for 4-5 years of manufacturing as after that the system is considered as end of life. 

Mark (2/16/2023, 9:01:13 AM): The option for me to procure parts is possible through Amazon, although they are not official Dell parts. They do work as I have tested them in the past. But the programming of the BIOS restricts it. At the very least, there should be a disclaimer to accept to proceed with the use of the non-Dell batteries. 

Mark (2/16/2023, 9:01:33 AM): It not just frustrating, it's restrictive. 

Tanuj S (2/16/2023, 9:04:00 AM): That is true. Every part is not compatible with the system. That is the reason parts goes obsolete as software and hardware products advances. 

Regarding BIOS, you can try to update the BIOS if it is not updated. 

Mark (2/16/2023, 9:05:56 AM): I will try the BIOS update. but this is a real disappointment in Dell. 

Mark (2/16/2023, 9:07:39 AM): If that fails, I am going to make a public post about this policy change as a warning to others who consider purchasing equipment from Dell and am going to look for another laptop provider who will support good equipment. 

Tanuj S (2/16/2023, 9:08:26 AM): Unfortunately there is nothing we can do in this case. This is situation with all the products. We can not procure parts after a certain point of time. 

Mark (2/16/2023, 9:09:12 AM): This is a sad moment for me. I've been a big Dell supporter for years. I have spend a LOT of money on laptops and other hardware. Knowing Dell will no long honor that loyalty means I need to find another place for  it. 

Tanuj S (2/16/2023, 9:10:58 AM): We really appreciate you being a loyal Dell customer however you also have to understand that the parts can not be procured for ever.

I wish there is something I can do for you. 

Tanuj S (2/16/2023, 9:13:30 AM): Is there anything else I can assist you today ? 

Mark (2/16/2023, 9:13:50 AM): I realize these laptops will not last forever, but their lives don't need to be truncated because Dell chooses to give up on them. There is a lot of tech out there outliving their expected life cycles with other options. I have extended the lives of these laptops already with third-party batteries, so it's possible. Having Dell cut that option off from customers is the change in all this. 

Mark (2/16/2023, 9:13:56 AM): No, I guess not. 

Mark (2/16/2023, 9:14:06 AM): Thanks for confirming all this for me. 

Mark (2/16/2023, 9:14:43 AM): And if it can make a difference, please let them know about how this affects a former customer. 

Mark (2/16/2023, 9:14:57 AM): ...how this affects a now former customer. 

Tanuj S (2/16/2023, 9:15:48 AM): Thank you for choosing Dell and allowing us the opportunity to assist you. Have a wonderful day! 

Mark (2/16/2023, 9:16:02 AM): You too.

At the very least, Dell, provide a legal disclaimer in your BIOS to shift the responsibility of potential problems to the customer. I would gladly accept the waiver knowing that the batteries could cause fires. To be honest, you cannot prevent your own batteries from not catching fire. Will you cover a house fire if your own official batteries overload and cause damage? (Maybe I need to read the fine print on the documentation more closely.)

I post this as knowledge before buying Dell equipment. If you do this, know that you will spend money for a limited life laptop, not because it cannot continue to live but because Dell will not allow it to continue to live.

One more thing: I cannot update the BIOS on these laptops because the BIOS has determined that being plugged into an outlet and a dead battery insufficient power requirement to allow the update. This has turned into a lose-lose scenario.

Very disappointed, Dell.

03 February 2023


This quote still seems appropriate in so many places that I built this meme, yet I don't have it readily available. So, I'm posting it here for my future reference.

The source of this was Alex Albretch's guest appearance on Tiki Bar TV years ago when he and Kevin Rose were producing Diggnation. The quote is genius. You can find that episode linked below, which at this point is still online.

I actually made a t-shirt with this quote.

Source video: https://vimeo.com/124379530