Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Get a devDuck
Rubber duck debugging has never been so cute! Get your favorite coding language devDuckBuy Now
Search - "logger"
My dad put parental controls on the wifi password, programmed a key logger to get the password.
Hooked ever since
(6 years ago)7
I actually talked to my duck. He solved my Server 500 error which said "java.lang.NoSuchFieldError: logger". I had to purge the build .class files and recompile the application and low and behold it runs.
Why is my duck a better debugger than most actual debuggers? He didn't even go to college!11
Yesterday the web site started logging an exception “A task was canceled” when making a http call using the .Net HTTPClient class (site calling a REST service).
Emails back n’ forth ..blaming the database…blaming the network..then a senior web developer blamed the logging (the system I’m responsible for).
Under the hood, the logger is sending the exception data to another REST service (which sends emails, generates reports etc.) which I had to quickly re-direct the discussion because if we’re seeing the exception email, the logging didn’t cause the exception, it’s just reporting it. Felt a little sad having to explain it to other IT professionals, but everyone seemed to agree and focused on the server resources.
Last night I get a call about the exceptions occurring again in much larger numbers (from 100 to over 5,000 within a few minutes). I log in, add myself to the large skype group chat going on just to catch the same senior web developer say …
“Here is the APM data that shows logging is causing the http tasks to get canceled.”
Me: “No, that data just shows the logging http traffic of the exception. The exception is occurring before any logging is executed. The task is either being canceled due to a network time out or IIS is running out of threads. The web site is failing to execute the http call to the REST service.”
Several other devs, DBAs, and network admins agree.
The errors only lasted a couple of minutes (exactly 2 minutes, which seemed odd), so everyone agrees to dig into the data further in the morning.
This morning I login to my computer to discover the error(s) occurred again at 6:20AM and an email from the senior web developer saying we (my mgr, her mgr, network admins, DBAs, etc) need to discuss changes to the logging system to prevent this problem from negatively affecting the customer experience...blah blah blah.
FRACKing female dog!
Good news is we never had the meeting. When the senior web dev manager came in, he cancelled the meeting.
Turned out to be a hiccup in a domain controller causing the servers to lose their connection to each other for 2 minutes (1-minute timeout, 1 minute to fully re-sync). The exact two-minute burst of errors explained (and proven via wireshark).
People and their petty office politics piss me off.2
1. Slack. Pretty good chat app for dev companies, I use it to prevent people standing next to my desk 40 times a day.
2. Unit testing tools, especially when fully automated using a git master branch hook, something like codeship/jenkins, and a deployment service.
3. Jetbrains IDEs. I love Vim, but Jetbrains makes theming, autocompleting & code style checks with mixed templating languages a breeze.
4. Urxvt terminal. It's a bit of work at the start, but so extremely fast and customizable.
5. Cinnamon or i3. Not really dev tools, but both make it easy to organize many windows.
6. A smart production bug logger. I tend to use Bugsnag, Rollbar or Sentry.
7. A good coffee machine. Preferably some high pressure espresso maker which costs more than the CEO's car, using organic fairtrade hipster beans with a picture of a laughing south american farmer. And don't you dare fuck it up with sugar.
8. Some high quality bars of chocolate. Not to consume yourself, but to offer to coworkers while they wait for you to fix a broken deploy. The importance of office politics is not to be underestimated.1
I just got asked by a colleague why do I use different levels of a logger. He said he's been writing code for 10+ years and never needed anything other than Logger.debug() 🤦♂️
Where the fuck these guys get their degrees? 😒22
What features would you want in a logger?
Here's what I'm planning so far:
- Tagged entries for easy scanning of log file
- Support for indenting to group similar sequential entries
- Multiple entry types (normal, info, event, warning, error, fatal, debug, verbose)
- Meta entries, so the logger logging about itself, e.g. disk i/o failures.
- Ability to add custom entry types, including tag, log-level, etc.
- Customizable timestamp function
- Support for JS's async nature -- this equates to passing a unique key per 'thread'; the logger will re-write all the parent blocks for context, if necessary. if that sounds confusing, it's okay; just trust that it makes sense.
- Caching, retries, etc. in the event of disk i/o issues.
- Support for custom writers, allowing you to e.g. write logs to an API rather than console or disk.
How about these features?
- Multiple (named) logs with separate writers (console, disk, etc.)
- Ability to individually enable/disable writing of specific entry types. (want verbose but not info? sure thing, weirdo!)
- Multiple writers per log. Combined with the above, this would allow you to write specific entry types (e.g. error, warning, fatal) to stderr instead of stdout, or to different apis.
- Ability to write the same log entry to multiple logs simultaneously
What do you think of these features?
What other features would you want?
I'm open to suggestions!19
during code review...
peer: "you should pass this variable, and extract the logger from it"
me: "why? it is a 3 line logging function. why not pass the logger instance?"
peer: "because that is our best practice. It is the way we do things"
me: "why is it a best practice?"
peer: "because it is. We use it everywhere!"
me: "No we don't. And I still don't understand why is this a best practice. can you explain?"
peer: gives ups, did not look at the mr, and was not going to.
mr stays open. probably forever.12
When you take procrastination to another level... Adding Good looking table style output with emoji in a logging script which is only to be used once in a lifetime 😁3
I'm planning on writing an open source (and much improved) version of my logger, but I'm stuck on picking a name :<
So, anyone have naming suggestions for a tagged and branching/nesting logging library? (ES6)
(I don't think "deforestation" is a good choice. sounds kinda bad.)23
Hello devRant, this is going to be my first time posting on the site.
I work for a gaming community on the side, and today one of the managers asked me to implement a blacklist system into the chat and reactivate the previously existing one temporarily. This shouldn't have had any issues and should've been implemented within minutes. Once it was done and tested, I pushed it to the main server. This is the moment I found out the previous developer apparently decided it would be the best idea to use the internal function that verifies that the sender isn't blacklisted or using any blacklisted words as a logger for the server/panel, even though there is another internal function that does all the logging plus it's more detailed than the verification one he used. But the panel he designed to access and log all of this, always expects the response to be true, so if it returns false it would break the addon used to send details to the panel which would break the server. The only way to get around it is by removing the entire panel, but then they lose access to the details not logged to the server.
May not have explained this the best, but the way it is designed is just completely screwed up and just really needs a full redo, but the managers don't want to redo do it since apparently, this is the best way it can be done.7
So this just happened,
Me and my co-worker (we are junior developers) were working on the same bug, it was a post call throwing a server exception.
We had asked for help to debug this issue from a senior developer the day before, he was quite busy with his own tasks.
He is one those kinds who would keep working even if the entire bay is wasting their time, always keeping to himself, needless to say I haven't seen him smile.
Back to my story, he couldn't spare time yesterday so we tried to squash the bug ourselves thinking he might have forgotten we had called him.He then comes out of nowhere, he firsr checks the button bindings, params sent and the call being made.
He then went through the backend code strategically placing the break points, clicks and debugs a few times and then opens the console. BAM!!!!
" D' hell yo !!" Shows up in the console, not just once but multiple times. Turns out I forgot the logger I had placed in the catch block.
He turns to me in super slo-mo looks me in the eye and whispers "what the hell yo!" and kept quite for some time, meanwhile the sense of cringe was slowly creeping on me. That was when he let out a loud blurt and the entire cabin turned to us. Needless to say it was awkward.
His smile was creepy though :/
Not work but
Years ago when i was in middle school i wanted to mess with the school computers a bit so i made a desktop shortcut for shutdown and changed the name and icon to google chrome.
The person in charge of the it department freaked out and thought some kind of a massive virus infected everything.
Long story short turns out they had an event logger installed, figured out it was me and what i did...
I nearly got expelled 😑2
What do you think about my project (Simple Windows keylogger)? https://github.com/xxczaki/logger
Language: C# :)3
Recently installed SonarQube and its been amazing to see the level of code quality (or lack thereof)
Some projects have 30 to 60 days of technical debt and I found a few files with a cyclomatic complexity over 100. I’m still learning what the “good” numbers should be.
Yesterday, couple of devs were very proud they were going to start reducing the numbers, they started with one of my solutions that had 5 minutes of technical debt. Yes, 5 minutes.
DevA: “OMG…look at this…it has a cyclomatic complexity of 11…that’s terrible. I thought we were supposed to be professional developers.”
DevB: “And take a look at this, he used the double-slash instead of a triple slash for comments. How does any of code even compile?!”
Me: “Maybe we should tweak some of those SonarQube rules so they make more sense to our code base. We’re never going to use unicode, so all those string culture warnings should go away and code comment formatting? Who cares? Be happy we have comments. I think we should also focus on the bigger fish in that pond. The CRM project is one of the biggest and has a lot of improvement opportunities.”
DevB: “There you go again, don’t bring me problems, bring me solutions..ha ha”
DevA: “Yea, no kidding …hey…did you see the logger? OMG…the whole class is over 25 lines…we gotta split that up into smaller projects so it’s more manageable.”
It’s a good thing our revenue stream isn’t dependent on people getting work done.2
I like my log messages to indicate automatically where in the code something happened, so that I can easily identify where a message originated from while tracking down problems.
In C/C++ this is nice and easy - write a logging routine, wrap it in macros for the different log levels and have that automatically output __FILE__, __LINE__ etc.
I wanted to do something similar in NodeJS, as I'd found myself manually writing the file name in the log message and then splitting functionality out into new files and it became a mess.
The only way I found to be able to do this was to create an "Error" object and access the "stack" member of it. This is a string containing a stack backtrace, suitable for writing to console/file. I just wanted the filename/line/routine.
So I ended up splitting the string into lines, then for each of the lines, trimming the surrounding spaces (or tabs?), and parsing them to see if the stack entry is inside my logger module. The first entry outside of that module must therefore be the thing that called it, so I then parse out the routine or object and method, filename and line number.
It's a lot of clumsy work but the output is pretty neat. I just wish it were simpler!2
Bunyan is a simple and fast JSON logging library for node.js services
Server logs should be structured. JSON's a good format. Let's do that. A log record is one line of JSON.stringify'd output. Let's also specify some common names for the requisite and common fields for a log record.11
Group assignment: writing a own Java logger component in a group of four, using nothing else than Java SE libraries, Maven and Jenkins. The software must be able to substitute the logger component without recompilation, just by editing the config.xml (setting jar file path and fully qualified class name of the logger).
I asked around on Slack which group is ready for a component exchange, so that we could test the switch. I found another group and I started doing some testing.
Then I got a `java.lang.NoClassDefFoundError: org/apache/log4j/Logger`. I got in touch with my peer from the other group and asked him, if they've been using log4j. Apparently they did, so I told him that the assignment was to write a logger of one's own, not just using log4j. Then he told me: "Uh, ok, I'm going to tell the guy responsible for the logger part about that..."
Was the lead dev on an ios/android project. I knew that i was not gonna spend much time there and was using them to add shit to the portfolio. my app is in the playstore and seems to be working fine, can't get credit for it and can't bitch about it either since i burned all bridges with that company. the app is a trucking logger logistics ba type of deal for a local company.
i was paid $400 dllrs a week. Yeah I know, ain't shit in the U.S much less Texas. But the thing gave me perspective:
Android development sucks big balls and ios is way easier and nicer on devs.2
It is 7:46PM...
I started debugging at 10:30AM...
.Net native making my app crash at startup... even before the logger can write anything...
Just now, I find out it is because of a 3rd party lib...
"Going crazy" can't even begin to describe today...
I really didn't need this shit today... just not today...
My companys custom logging library is not thread safe and has problems with multiple instances of the endproduct as well.1
Perfect use of DI in .NET Core project.
> Passed logger object in UI project's controller class constructor.
> Then pass it to internal class.
> Then pass it to business project.
> Then pass it to another class and finally used logger in a method to log exceptions in try-catch1
What is your Favorite library that you always try to include in your code?
4)Other if so mention what is that Library
The above question is for any programming language9
Not a rant, just something that made me laugh way too much. We wanted to test this error logger we made to see if it could report where the error happened, so we wrote a function that just throws an exception. Not sure what to call it, we called it “shitTheBed”.
So it looked like:
I almost want to leave it there.2
Our company's first open source project: https://github.com/digineers/...
It's a Symfony bundle that enables logging changes to entities to allow simple mutation logging systems.
Would love to read some of your opinions :)1
$logger->log_info("Dumper ln:[" . __LINE__ ."] INFO:" , Dumper(%cmd));
[May 1,2018 12:46] Dumper ln: INFO: 2018-05-01-T12:46:04
Replaces < , > with < . > in line 1.
[May 1,2018 12:53] Dumper ln: INFO:$VAR1 = 'SQL dude why?';
Mother of Perl !!!
So apparently changing the root password on my embedded linux system from the default to anything else breaks ssh. The only error i get is, that the password has "expired".
Dis is gonna take a long time to figure out, cuz no system logger and only serial access...2
I started studing C#(I already studied some languages some C or Python), I never used it because of .NET platform(I hate Microsoft), so in those days I started studing it with Mono.
C# is far better than Java.
So I started a simple project and pushed it on GitHub,
it is a simple logger.
me on typing on Google ...
How to write a keyboard logger script and upload to a password protected computer?
:xD that evil plan.6
I spent half a day trying to figure out why the app on the staging server does not log in the app log file while it does on the dev server.
Server log said log config file found but could not find the root logger.
Problem was that the directory was readable for the app, but not the logfile configuration file.
Dear devs, when a file is not readable that might be some interesting information one could write into a log. AT LEAST MORE INTERESTING THAN "APPLICATION STARTING..."