coding

Log Levels

Tagged:  

As a sysadmin I spend much of my day trawling though log files looking for problems.
Unfortunately many developers don't appear to know how to use log levels effectively which can make a sysadmin's life a small hell when it comes to debugging.

As a general rule I advise the following:

Be quiet about successful operations and verbose about unsuccessful ones.

Yes I like to see what an application is doing but I don't need to know every function call that it's making, yes this is useful when developing an application but can make isolating a problem in production a real pain.

Generally I use 4 different log levels:

  • DEBUG
  • INFO
  • WARN
  • ERROR
    • The definitions for these go something as follows:

      DEBUG Things that should happen but you don't want to see in production. This includes function tracing, SQL statements, variable values etc...
      INFO Things that should happen that give you just enough idea about what's going on. This should be limited to 1 or 2 lines per transaction,
      WARN Things that shouldn't happen but the end user should see no difference. For example $foo failed so falling back to $bar instead
      ERROR Houston we have a problem! This is a serious error that has caused a problem for the end user. If you want to dump variables to the logs then now is a good time to do it.

      Some applications do logging in a completely different way, they have more log levels. Generally in production you want to know just enough to know what the application is doing + all the warnings and errors.

      If something goes wrong then you need enough information to be able to replicate it. If all is well then, as sysadmins, we don't care.

Temporary Solutions

Tagged:  

I'm a firm believer that temporary solutions become permanent very quickly however this quote from mySQL DBA is by far the best way of putting it.

Remember kids

There is nothing more Permanent then a temporary solution

Bash Scripting Guide

Tagged:  

I'm not convinced on some of the coding style but definitly looks useful.

http://freeos.com/guides/lsst/

DrySQL

Tagged:  

Currently investigating this Ruby on Rails thing that everyone is raving about and so far I'm liking it.

DrySQL is one of the many examples as to why Rails rocks :)

DrySQL is a Ruby plug-in that extends ActiveRecord and applies the DRY principle to Object-Relational Mapping.

The idea behind DrySQL is that you define columns, keys, constraints, and relationships on your database, and you shouldn't need to re-define any of these things in your application code.

Shame about this thou...

has_and_belongs_to_many association generation is not implemented at this point

... hopefully it'll be supported soon.

Syndicate content