1

I want to create a log file in my program.

My log pattern should contain: Log type, Datetime, Thread Name, Method Name, Log detail.. etc...

Which log pattern do you suggest?

Does any accepted log pattern for this? For example "trace log pattern", "event log pattern" etc...

4 Answers 4

5

Use a logging library such as NLog or Log4Net Then you can tweak the layout & renderers all you want without changing code or recompiling, and have lots of other useful functionality as well (such as rolling logs, db/network/email appenders, filters, log levels etc).

A good comparison of some logging frameworks

3

I REALLY recommend using Log4net; it supports almost everything you'd possibly want to do, is almost freakishly robust, and very straightforward to put in place.

You can find it here.

0
1

Why don't you try a logging framework like Log4Net ? There are plenty of tutorials around...

1

The Microsoft Application Blocks have some very good boiler plate code you can start with. The Logging Application Block can be used by itself, with other MAB elements or simply as a starting point for rolling your own.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.