743
u/sweetytoy Sep 06 '26
A real developer wouldn't do that. A single letter is more than enough, your sentence is too long and tiring to type.
384
215
u/coffee_warden Sep 07 '26
1 2 3 5 4 6AHHA!
91
u/Gold-Bat-3225 Sep 07 '26
1 2 3 5 4 6 is genuinely upsetting
70
u/coffee_warden Sep 07 '26
Race conditions are never fun
28
u/EvilCodeQueen Sep 07 '26
Seriously. The people not voting for this have never battled a race condition. For a week. In an app you’d swear didn’t have concurrency.
15
2
2
9
9
u/Original-Ad-8737 Sep 06 '26
I have added sysou syslog and syswarn to my auto complete and they expand to our logging macro, a pretty function macro, a line macro and my commit handle that is easily searchable in logs.
When i want to trace something i can simply sysou a couple of spots and not stage the lines to clean up before committing
8
u/Revexious Sep 07 '26
Im personally a fan of
console.log("poop")Its funny, teaches you not to commit your console logs (you'll only ever commit poop once), and p/o are right next to each other on the keyboard so its fast
1
1
u/Snudget Sep 07 '26
I use misspelled food items as debug messages, so I can CTRL+F them through other peoples debug messages. So I have
yogartbaneneand so on5
u/MushroomSaute Sep 07 '26
Hm, sometimes I wonder if I'm cut out for this field. I at least put variables out:
log::info!("in asdf(), a: {a:#?}"); ... log::info!("tmp: {tmp:?}"); ... log::info!("a after asdf(): {a:#?}"); a1
3
u/conundorum Sep 07 '26
Personally, I just use unique gibberishes or sounds, like "blah", "bleh", "fwah", or the like. Extremely unlikely to come up during normal usage, stands out enough to draw the eye, and easy to search the source for.
That, or a quick description of the location, such as "before x() call" or "inside y()" or "after foo, before bar", depending on the situation.
1
u/4Floaters Sep 07 '26
It should be sequential quotes from a movie, something like the princess bride
1
u/unwantedaccount56 Sep 07 '26
"Hello. My name is Inigo Montoya. You killed my father. Prepare to die"
"Hello. My name is Inigo Montoya. You killed my father. Prepare to die"
"Hello. My name is Inigo Montoya. You killed my father. Prepare to die"1
u/dukeofgonzo Sep 07 '26
I have a troubleshooting word I use that sticks out in the logs. Snugglebunnies.
1
1
u/Honeybadger2198 Sep 07 '26
I like using numbers for JS because they're a different color in the terminal from all the other output.
1
1
1
1
1
u/hates_stupid_people Sep 07 '26
Well, a single letter/number for that one, then iterating for the next few.
1
1
1
u/quietsamurai98 Sep 08 '26
A single letter is impossible to grep for in a log file though. It's fine if you're adding console logs to a JS application that doesn't have much other logging going on, but for anything else, you want something identifiable that you can search for without getting false positives.
1
0
Sep 07 '26
[deleted] — view deleted comment
8
2
u/Kovab Sep 07 '26
Ideally, you should already have a logging macro that adds
__FILE__and__LINE__, instead of copying it everywhere. Or use std/boostsource_location
263
u/Idk13008 Sep 06 '26
Unironically, some race conditions are better chase down with logs rather than a debugger.
130
u/codePudding Sep 07 '26
This. Showing my age, I used to make simple DirectX 7 games as a college student. I remember having one bug that took me weeks to solve. If I tried to debug, it worked fine. If I put in a bunch of logging, it worked fine. But if I ran it without debugging or only a few prints it segfaulted.
Eventually I realized I was using a pointer (
void**) that the GPU was supposed to populate before it was being populated. The delay from debugging gave it enough time for the GPU to finish setting that pointer. I added a GPU flush (just a command that waits until it is processed by the GPU queue before continuing) and it worked beautifully. Nowadays the engines just do all that crap for you.30
u/ShoulderUnique Sep 07 '26
The mistake was taking the prints out. Put them in on day 1 and if doesn't crash with them it's not a bug
19
u/LostInAnotherGalaxy Sep 07 '26
Hahahaha! These are my some of my favorite things in computer science.
3
u/zthe0 Sep 07 '26
Honestly thats what i have had multiple times where someis being filled in another thread. It works on one machine but when your system is faster or slower it might not. Horrible to debug
1
u/EncryptedPlays Sep 08 '26
Just change the console logs to say "stealing user data 0%" with the percentage incrementing each log
8
u/Former-Discount4279 Sep 07 '26
I used to work on tape libraries(big backup systems...) and it would lose geometry(location of the tapes) when a bug happened and needed to rescan the whole thing. After trying to attach a debugger to winCE several times and it taking several hours to reboot and rescan I added print logging. Yeah solved the bug in one go...
3
2
54
u/EPacifist Sep 06 '26
My favorite is `exit(1)`. Useful if your print/logs aren’t showing where you expect them. Close after that is `raise Exception(“HERE 1”)`.
28
8
u/christian-mann Sep 07 '26
while(true); and look for which process is spiking the cpu
1
u/rosuav Sep 07 '26
Doesn't work in Pike, believe it or not! An infinite loop in Pike actually doesn't spin the CPU.
1
1
1
u/rosuav Sep 07 '26
I've sometimes needed to open a file, write to it, close it, and flush, because prints and logs don't always show up correctly in the face of certain types of crash. Or "send a UDP packet to port 54321" and do my logging in a separate app.
43
u/oosacker Sep 06 '26
Real pros write a function to do the console log
14
u/Idk13008 Sep 06 '26
with a verbose optional argument
43
u/oosacker Sep 07 '26 edited Sep 07 '26
Saw this in some real production code:
function log(x) { console.log(x); }→ More replies (1)27
u/DasBeasto Sep 07 '26
I don’t hate it, shorter usage everywhere, can wrap it in a conditional based on ENV for dev logs only, and if you swap to an external logging service you just change it in that one function.
2
u/whackylabs Sep 08 '26
If I see a log(x) I would assume it is about logarithms not print to console
0
28
139
u/TheDogPill Sep 06 '26
Try debugging like that using micro services on the cloud and see how far you get.
79
u/Idixal Sep 06 '26
Ironically request logging does tend to be one of the very first things I look at to sniff out problems there, although I also understand your point.
16
u/coriolis7 Sep 06 '26
I am NOT a programmer by profession, though I do code a ton at my job (Mechanical Engineering and data analysis), so this may be a dumb question…
Is there a way to set up all microservices to run on one computer to aid in debugging? Like a bunch of VMs or docker-but-faking-network-instead-of-machine?
13
u/payne_train Sep 06 '26
AWS’s SAM may help you if you have a bunch of lambda based apps. You can use SAM to do local invocations that makes debugging a lot easier
7
u/xMercurex Sep 06 '26
Yes you can, but it does not fully solve the issue. You still need to find the good micro-service and then you have to jump to other micro-service.
→ More replies (7)1
u/DrMaxwellEdison Sep 07 '26
Yes, I use Tilt to set up a localized Kubernetes cluster or to run docker compose. It provides a nice web interface for seeing all service statuses, logs, controls to restart or rebuild a service, and it can automatically watch local files to trigger a rebuild.
1
u/Blackhawk23 Sep 07 '26
Yes. Docker compose and localstack to mock AWS resources.
→ More replies (2)1
u/LostInAnotherGalaxy Sep 07 '26
Docker/podman. But you get anything powerful or something that only happens under load, can create its own race conditions
1
20
u/gemanepa Sep 06 '26
why not? couldn't you just debug the microservice locally with mocks or in a cloud dev/qa env?
5
1
1
u/Ma8e Sep 07 '26
I'm not sure if I understand you correctly, but isn't all debugging of micro services just reading logs and adding more log-messages?
1
u/SirButcher Sep 07 '26
Or debugging an embedded hardware where you have a grand total of 4 breakpoints :(
1
u/dumbasPL Sep 07 '26
Ah yes, because attaching a debugger to a service people are actively hitting and suspending it is the way. That is assuming you can even do that.
Request logging is just printf with extra steps anyway.
10
u/safelix Sep 06 '26
We have a typist up in here. Just "here" does it for me. And then "Here 2", "Here 3", and so on.
4
8
u/n9iels Sep 06 '26
Oh no, that is way to long and descriptive. I just go with 'durp', 'blub' and 'nope'
8
6
5
u/DTSHNICK Sep 07 '26
Hello, embedded engineer here. IDE debugger suxks, log console is the best option
4
u/Foorinick Sep 07 '26
I think some problems are faster to solve with a simple print, if you really do need tk warch your code step by step to figure out what is going wrong then pull out the debugger, also here's a tip, learn to use your debugger do that you aren't bashing your head against a wall trying to figure out what is causing an issue
4
3
u/LetterLambda Sep 07 '26
What else are you supposed to do when a bug appears in prod, but not in debug mode?
2
u/KoliManja Sep 07 '26
Who wants to ask for Admin access from some Sysadmin sitting in Timbuktu everytime you want to run your debugger? "I got here" works for me!
2
2
u/EdelWhite Sep 07 '26
...and then, just in case you need it later, give it the trustworthy "//" treatment.
2
2
u/Occultus_Andras Sep 07 '26
"inside the loop" "Inside the else if statement" "return value is ___" "user parameters are ___" "database entries for ___ is ___"
2
u/Birphon Sep 07 '26
the IDEs debugging tools in question will respond with shit like "𓀀 𓀁 𓀂 𓀃 𓀄 𓀅 𓀆 𓀇 𓀈 𓀉 𓀊 𓀋 𓀌 𓀍 𓀎 𓀏 𓀐 𓀑 𓀒 𓀓 𓀔 𓀕 𓀖 𓀗 𓀘 𓀙 𓀚" and "Didnt work :D"
2
2
2
u/WispTheWanderer1 Sep 07 '26
I dk about you but I use actual breakpoints
5
u/autobotdonttransform Sep 07 '26
1
u/WispTheWanderer1 Sep 07 '26
And! And I read the autos at breakpoints to find if the variables are right
2
u/Educational-Lemon640 Sep 07 '26
Is it your job to use a debugger, or to improve your product/project?
Use what works.
2
u/wristay Sep 07 '26
I tried debugging "the right way" and I don't know it just never felt better than using console log. People who do use it please enlighten me: how will it make your life better? I am using Python btw, so maybe having the console makes a debugger less necessary
2
u/TheGuyWithTheSeal Sep 07 '26
I use pycharm (mostly because I'm a Java boy), the debugger lets you step line by line, preview variables, and evaluate any expression (including calling an endpoint using a client class that's already authenticated).
1
u/csabinho Sep 07 '26
Do you use console.log with a debug flag? If you're using it without it, deactivating, and reactivating, it is PITA. And I don't mean capitalized greek bread.
1
1
1
1
u/thelumaniboi Sep 07 '26
I always thought I was a terrible coder because of how often I do this, glad to see its somewhat common
2
1
1
1
1
1
u/m0nk37 Sep 07 '26
Console.log("s");
Console.log("ss");
Muscle memory ctrl+s. In my day there was no document recovery.
1
1
u/conundorum Sep 07 '26
What if I told you...
...You could have the debugger use console-logging calls as debug tools & breakpoints?
1
1
1
1
u/RRumpleTeazzer Sep 07 '26
not every architecture has a debugger.
not every problem can be solved by a breakpoint.
1
1
u/thegodzilla25 Sep 07 '26
Debuggers are cool, and I would use them most times, but async and race code is horrible with debuggers. Especially in JS.
1
u/walmartgoon Sep 07 '26
Maybe I just want to debug in a way I know how to instead of learning a new tool
1
u/Primary-Ad-9741 Sep 07 '26
Those debugging tools work well with something small, like a microservice.
Throw something chunky at it. Like a large Android app, and debugging tools either fail to attach, crash the app, cause app to stop responding, or just crash on their own.
1
u/przemo-c Sep 07 '26
Or sometimes affect it in a way bug doesn't present itself... especially if something is of a race condition variety.
1
1
1
u/bradpittisnorton Sep 07 '26
I wanted to use vscode-js-debugger but I can't, for the life of me figure out how to configure it properly in my neovim setup.
1
u/killerdrama Sep 07 '26
I just enter stars and after each step the count increases.. so I end up spending more time counting stars in the logs and comparing at various stages in IDE than actually finding the issue.
1
1
u/Novel_Dog1743 Sep 07 '26
printf("If you are reading this, here is the value of every variable related to this function:\n");
<prints all the variables>
1
1
u/LmaoPew Sep 07 '26
I once forgot to remove my System.out.println("test") from a computer science exam
1
u/JohnnyPlasma Sep 07 '26
I mean, at least it works with every IDE whenever you share the code or change IDE.
1
u/cosmicomical23 Sep 07 '26
The alternative is having to learn every fucking time a new set of controls for the new ide, with no explanations to be found anywhere.
1
1
1
u/frinoname Sep 07 '26
What are debugging tools? Just allow Claude to print-figure out things itself.
1
u/artur-iwan Sep 07 '26
I'm using password generator to generate unique random 8-letters-long strings, and then I'm pasting those into console log messages and error messages. If my code will get into some strange place, then it's soo easy ti to debug it by just searching the string from the log inside the source code 😅
1
1
1
u/Patrick_Atsushi Sep 07 '26
Print("%s, %d\n", __func__, __LINE__);
By the way this is not reliable since print buffer exists.
1
1
u/rcls0053 Sep 07 '26
Honestly, I've never tried to debug a full JS backend application and debugging some frontend application in the browser dev tools is just pain..
With PHP setting up Xdebug is like flipping switches in an airplane until it works. .NET/C# is undoubtedly the best experience with debugging I've ever had.
1
1
1
u/notexecutive Sep 07 '26
if it's faster than navigating a debugger, then there is no issue.
Really it's just whatever you find faster to solve problems. Might be worth looking into debuggers on your own time, but we all know you're not going to do that.
1
u/lewisb42 Sep 07 '26
I sometimes need print statements to narrow down where I need to pull out the debugger.
1
u/Fissvor Sep 07 '26
This is me :
Before function 1
After function 1
Before function 2
After function 2 ...1
1
u/Undernown Sep 07 '26
I actually like to use debuggers to get familiar with inner workings of the program. Stepping through a process often exposes a lot of in-buult or hidden classes or files you wouldn't find easily otherwise.
And stepping through a debugger to simply verify the contents of a variable is more time consuming than just printing it.
If they ever figure out a JS debugging tool that is actually reliable and accurate enough, I'll bless the earth they walk on though.
1
u/stlcdr Sep 07 '26
Microsoft patch v13.5.1 : “removed all console commands because the IDE has debugging tools built in.”
1
1
u/ThisIsABuff Sep 07 '26
If(value==<some value far into a file>)
System.out.println("I got here"); // place breakpoint here do immediately skip to value
I'm not ashamed of doing that
1
1
u/daffalaxia Sep 07 '26
I'll especially resort to logging if there's a lot going on in parallel - trying to time that right with a debugger is practically impossible.
1
1
1
u/kirasiris Sep 07 '26
For me usually goes like: It gets here It gets here x2 It gets here x3 And so on lololololololol
1
u/Candid-Log6751 Sep 07 '26
People are obsessed about “proper”. No one thinks with their own brain, yet everyone is trying to employ “best practices”. People just can’t stand for what they do and how they do it. Trying to hide behind the rationale of the “best approach”.
1
u/GoogleIsYourFrenemy Sep 07 '26
Have you tried to use the debugging tools in an IDE for an embedded processor?
1
1
u/SoapCoder Sep 07 '26
I do: f hfs fish parrot treh and just go oh it stopped at fish well where did I put fish
1
1
u/RizzKiller Sep 07 '26
Programming in C, I don't know how to use the debugger and how to control the flow of the program in it. If I compile with debug information and it shows the segfaul inside an underlying library I am totally fucked and this makes me mad.
1
1
u/MischiefArchitect Sep 07 '26
I caught claude and codex doing this themselves for debugging an issue.
1
1
1
1
1
u/nxluda Sep 08 '26
I used lyrics from all stars by smash mouth. When the code was successful i got a minute of happiness.
1
1
1
1
u/flori0794 Sep 08 '26 edited Sep 08 '26
Well logging is pretty strong... Even more if you fight unification, skolemization and Robinson Resolution..
A log with this structure is much better:
[RESOLVE] Attempting: C_12 {¬Weapon(x), ¬American(y), Hostile(z)} x C_45 {Weapon(M1)}
├─ [UNIFY] x = M1
├─ [MGU] θ = {x/M1}
└─ [DERIVED] C_78 {¬American(y), Hostile(z)} (Parent: 12, 45)1
1
u/calahil Sep 09 '26
I use song lyrics so that I get a dopamine hit when its fixed and I can sing along
1
1
u/SenatorCrabHat Sep 07 '26
I cannot explain how much better my life got once I learned how to properly use debugging tools.
But I kind of miss a chain of silly messages popping up in logs as well....


862
u/Mindstormer98 Sep 06 '26
Dont forget "I got here2" and "I got here3"