The idea was sound: make a generic logger that could log anything and everything, anywhere and everywhere, anyhow and everyhow. Granted, there were already several open-source, commercial, and built-in logging options that basically did that already, but the Über Logger would sit at a level above all of these loggers and thus could log to another logger... or even all of the other loggers. At least, that was the theory.

In practice, the Über Logger turned out to be a little more... messy. "Basically," wrote Floyd, "this method is, naturally, copied-and-pasted on all of some 200+ ASPX files where logging is needed."

private void WriteLog(string sId)
{
   BLL.Components._LogEntry logEntry = new _LogEntry();
   logEntry.UserId = 0; 
   logEntry.CompanyId = 1;
   logEntry.QuoteId = 0; 
   logEntry.CustomerId = lCustomerId; 
   // I can't make anything in the LogType enum work on FC :(
   logEntry.EventTypeId = (int)Global.LogTypes.RECOVERDROPPED;
   logEntry.ActionDescription = "Added missing Id.";

   // **********************************************************
   // ************************** STRINGS ***********************
   // **********************************************************
   logEntry.GenericVariableString1 = sId; 
   logEntry.GenericVariableString2 = "WebForm1.aspx"; // Not real page name, thankfully...
   logEntry.GenericVariableString3 = String.Empty;// Future use...
   logEntry.GenericVariableString4 = String.Empty;// Future use...
   logEntry.GenericVariableString5 = String.Empty;// Future use...
   logEntry.GenericVariableString6 = String.Empty;// Future use...
   logEntry.GenericVariableString7 = String.Empty;// Future use...
   logEntry.GenericVariableString8 = String.Empty;// Future use...
   logEntry.GenericVariableString9 = String.Empty;// Future use...
   // **********************************************************

   // **********************************************************
   // ************************* INTEGERS ***********************
   // **********************************************************
   logEntry.GenericVariableInteger1 = 0; // Future use...
   logEntry.GenericVariableInteger2 = 0; // Future use...
   logEntry.GenericVariableInteger3 = 0; // Future use...
   logEntry.GenericVariableInteger4 = 0; // Future use...
   logEntry.GenericVariableInteger5 = 0; // Future use...
   logEntry.GenericVariableInteger6 = 0; // Future use...
   logEntry.GenericVariableInteger7 = 0; // Future use...
   logEntry.GenericVariableInteger8 = 0; // Future use...
   logEntry.GenericVariableInteger9 = 0; // Future use...
   // **********************************************************

   // **********************************************************
   // ************************* DECIMALS ***********************
   // **********************************************************
   logEntry.GenericVariableDecimal1 = 0.00M; // Future use...
   logEntry.GenericVariableDecimal2 = 0.00M; // Future use...
   logEntry.GenericVariableDecimal3 = 0.00M; // Future use...
   logEntry.GenericVariableDecimal4 = 0.00M; // Future use...
   logEntry.GenericVariableDecimal5 = 0.00M; // Future use...
   logEntry.GenericVariableDecimal6 = 0.00M; // Future use...
   logEntry.GenericVariableDecimal7 = 0.00M; // Future use...
   logEntry.GenericVariableDecimal8 = 0.00M; // Future use...
   logEntry.GenericVariableDecimal9 = 0.00M; // Future use...
   // **********************************************************

   bool retVal = logEntry.InsertLogEntry();

   logEntry = null;
}

"At least it's not XML stored in SQL Server," Floyd added, "although we have a lot of that as well."

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!