user3512982
user3512982

Reputation: 61

Log4net get log text

I need get log text from log4net.

For example

Configuration:
%date [%thread] %-5level %logger [%property{NDC}] - %message%newline
Text:
2013-11-25 16:05:22,306 [13] ERROR REJS.Web.Controllers.BaseController [(null)] - Exception System.ArgumentException:

And I need this Text.

can anyone help me?

Thank for your answers.

Upvotes: 3

Views: 1221

Answers (1)

LB2
LB2

Reputation: 4860

You can use log4net's MemoryAppender which you can use to get back the buffer written. There is SO thread at Is there a log4net memory appender? that describes how you can use it.

Word of caution - you will need to actively manage purging data from it, since if you don't, it'll keep accumulating data until it runs out of memory and your process dies. Without purging data, it'll essentially create a fantastic memory leak.

Upvotes: 6

Related Questions