开发者

How do I manage WCF log file sizes programatically?

开发者 https://www.devze.com 2023-04-08 04:55 出处:网络
We\'re having a bit of trouble managing the file size of the WCF logs at my organization. The logs are getting large, really large. Multiple gigabytes of data.

We're having a bit of trouble managing the file size of the WCF logs at my organization. The logs are getting large, really large. Multiple gigabytes of data.

I am a bit of a WCF rook开发者_如何学运维ie, but I realize that there are options to turn down the level of information being logged. However, what I'd prefer to do is setup some sort of automatic archiving process for the logs, so that on a certain frequency (maybe every night) the logs are automatically archived into a separate folder for up to 5 days. This way we can have fresh and manageable log sizes in the morning when we discover an issue with one of our services.

I don't really know what the best approach to this would be. Are there .NET classes that give me access to the SVC log files? Or, would I need to write a service that specifically turns off the service, renames and moves the logs on the file system, then turns the service back on?

Any help is appreciated!


There is a nice CodeProject for rolling your WCF service logs:

Ever had the problem of growing svclog files after configuring tracing in a productive WCF environment? Did not want to restart the application just for deleting or moving the trace files?

Then, you will like the RollingXmlWriterTraceListener, which is a specialized XmlWriterTraceListener, and is completely compatible with the WCF tracing facility.

Does the trick nicely ...

0

精彩评论

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

关注公众号