0

I have an N-tier application, ASP.Net front end, then a .Net C# Business and Data Access Layer. I have created a simple custom logging library. This logging library is then used throughout my application i.e. Log.LogException and Log.LogMessage.

For this logging library I want to define the custom path for the logs folder created by my application. I initially thought the correct approach was to use an App.Config for my Logging library and then read in the path from there but the problem is that when I publish my Web App to its Target Location it copes all the binaries across including the logging DLL but not the accompanying App.Config.

This leads me to believe that this is not the right approach. I could do some "hack" to copy it across but that is a bad idea if it is not the best design approach.

Is this a supported design or am I going down the wrong route?

Thanks!

1 Answers1

2

You need to have your custom path for the logs in the Web App config, or add your custom config to the Web App, which will deploy it when you publish.

see here: moving the config files for a dll to the app that calls the dll

However, I'd suggest doing away with your custom logging library entirely, and use something like this: http://nlog-project.org/

Community
  • 1
  • 1
Eric Dahlvang
  • 8,252
  • 4
  • 29
  • 50
  • Thanks Eric. Yea I kind of expected an answer "don't waste time building your own when there are existing logging solutions" but for now I need to do some custom stuff that is better suited by own library. So I think I'll go with the suggested solution. – Michael Hollywood Apr 15 '12 at 15:57