开发者

NLog logging to database in n-tier environment

We are currently using NLog for logging (which was an arbitrary choice made some months ago so it can be changed if necessary).

NLog can log to a database but requires a ConnectionString. This is an issue for us as we are in an n-tier environment and we 开发者_如何学运维have no database access at the Presentation tier (everything goes back to WCF hosted services in the mid-tier).

Does anyone have good recommendations for how I can get logs from a webfarm into a single consolidated repository (SQL, or it could be some other technology, e.g. MongoDb, etc.) that will sitting behind the mid-tier WCF?

Yes, I know that WCF and other issues can occur when trying to get to the logging repository (inaccessibity etc.) and in that case we will configure server based file logging or something to catch that.

I could use some wisdom here please.

Brian


For business logic related logging (ie not system errors), I would recommend creating a WCF endpoint and wrapping nlog in your business tier. So you would call your logging methods as you would any mid-tier method.

That leaves the system errors like db/network errors etc. For these the options include windows event log, email, file, twitter:) etc.. choose your pick. as long as it does not rely on database you are fine. And depending you how critical your app is, you may want to use a couple of methods like filesystem + email.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜