In my webapplication (C#, .Net 3.5), made up of a core class library (containing the business logic, data layer and a couple of utility classes), a windows service project, a webservice project and the website project, I have a couple of static classes in the core library used by all other projects. These classes (for example the Log class) require some initialization (They have an Initialize method) in order to set them up for usage. As an example, the Initialize method of the Log class has a directory path parameter which tells the Log, where to save the logfiles to. Alternativly I was thinking of loading the "settings" for the Log class from a configuration file in the static constructor. The drawback is, that I need different settings for unit-testing then in production code.
Is there a better way to design this? The drawback of this approach is, that all consumers of the static class will attempt to call Initialize. This is not really a problem because once initialized, the method will return immediately instead of executing the Initialize code again, but the design seems a bit weird to me.
I hope my english is sufficient to explain what I'm after. Do not hesitate to ask if the question is not clear enough.