Slashdot Mirror


Software Logging Schemes?

MySkippy writes "I've been a software engineer for just over 10 years, and I've seen a lot of different styles of logging in the applications I've worked on. Some were extremely verbose — about 1 logging line for every 2 lines of code. Others were very lacking, with maybe 1 line in 200 devoted to logging. I personally find that writing debug and informational messages about every 2 to 5 lines works well for debugging an issue, but can become cumbersome when reading through a log for analysis. I like to write warning messages when thresholds or limits are being approached — these tend to be infrequent. I log errors whenever I catch one (but I've never put a 'fatal' message in my code, because if it's truly a fatal error I probably didn't catch it). Recently I came across log4j and log4net and have begun using them both. That brings me to my question: how do the coders on Slashdot handle logging in their code?"

7 of 225 comments (clear)

  1. I Don't! by Vectronic · · Score: 4, Funny

    I don't, save the rain forest, hug a tree, prevent deforestation, stop logging now!

  2. I let the kernel do it for me by ILongForDarkness · · Score: 2, Funny

    Segmentation fault: core dumped

  3. One line of logging for every line of comments by sprior · · Score: 3, Funny

    That should be about right...

  4. ONLY IF... by Jane+Q.+Public · · Score: 2, Funny

    ... you are of the opposite sex, have no significant communicable diseases, and pay your own way.

  5. Re:As little as practically possible by darkpixel2k · · Score: 5, Funny

    ...nothing's as frustrating as trying to analyze a log that came in from the field where there's just no information about what went wrong.

    [ 56.529336] WARNING: A-fib detected
    [ 56.568802] INFO: charging defib
    [ 56.741096] INFO: charging ccomplete
    [ 57.218803] ALERT: shocking!
    [ 58.061815] Buffer I/O error on /dev/paddles
    [ 58.163210] zapper[22402]: segfault at 000000c4 eip b321bf5f esp b320a870 error 6
    BUG: unable to handle kernel NULL pointer dereference at virtual adress 00000000
    printing eip: c013186b *pde = 00000000
    Oops: 0000 [#1] SMP
    Modules linked in: battery ipv6 paddles ac button battery cardiac_monitor thermal processor zapper fan

    Man, I'd feel bad after that output...

    --
    There's no place like ::1 (I've completed my transition to IPv6)
  6. Re:Standard format for domain information by MichaelSmith · · Score: 2, Funny

    Enjoy all the fun of ADS-B =) As an IT professional and a private pilot, I hope if you're working on a project related to that, it works flawlessly.

    Cripes if it is working flawlessly we had better stop changing stuff ;)

  7. Re:As little as practically possible by zotz · · Score: 4, Funny

    I think you might be missing the main reason. If we don't reduce software logging, pretty soon there will be no old growth software left.

    all the best,

    drew

    --
    FreeMusicPush If you want to see more Free Music made, listen to Free