Thursday, April 15, 2010

Extension of log4j for logging in SaaS services

When developing SaaS you (hopefully) have many customers accessing your service.
Suppose one customer calls in and says that in a specific flow he has a problem (for example, when he asks for the lists of the assets he manages he gets HTTP error 500).
He's the only customer that complains about this flow, so it's something unique to this customer.
You look at the logs and you don't have enough information to figure out what went wrong (no surprise, you see your "ThisCanNeverHappenException").
The obvious thing to do is to change the log level to DEBUG and let the customer retry his flow. The side effect is frightening, your single log file is gigantic and you can't find your arms and legs anywhere. Debugging never looked this bad.

This project is an extension for the log4j framework allowing logging messages from different customers to different log files, with different logging levels for each customer:
http://code.google.com/p/saas-logging/