Back to list
Views:   5.3K
Replies:  1

ObserverLogToDatabase and DAL circular reference


I need to log to both the windows event log and to the database for an application I am building.  I have separated the logger to its own project and included it in just about every layer that needs logging.  

The problem is that I want to use a DAO for logging to the database.  If the logger DAO is included in ObserverLogToDatabase, then I have a circular reference.

Any recommendations on how to get the logger to go through the same layers as other code that needs to access the database?
Mr. Query, Mar 07, 2014
Reply 1
What you are doing is correct:  factor the logging functionality into its own project. 
As far as logging using DAO the answer would be to place DAO into its own project.  
But at some point you have to stop or else you end up with many small projects. 

An alternative would be to copy some minimal DAO code that is focused on logging to the database (I know, some will frown up this). Anyhow, it is probably  just a few lines of code and solves the circular reference problem. 

Jack Poorte, Mar 08, 2014
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.