Azaz ul Haq
Azaz ul Haq

Reputation: 1747

Log4Net How to Log plain text without time

I'm writing logs to a text file using Log4Net.dll v1.2.10. Here is how I'm logging the information:

Private loger As ILog = LogManager.GetLogger("MyAppName")

loger.Debug("some message")

Here is what I see in log text file:

2018-10-25 13:46:15,970 [6] DEBUG - [MyAppName] some message

My question: Is it possible to only log "some message" text in file without timestamp and other extra information?

Any kind of solution or workaround would be highly appreciated.

Upvotes: 2

Views: 423

Answers (1)

Stefan Egli
Stefan Egli

Reputation: 17018

That is very easy. Configure your file appender to use this layout pattern:

<layout type="log4net.Layout.PatternLayout">
     <conversionPattern value="%message%newline" />
</layout>

Upvotes: 4

Related Questions