Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 368
user3512982 Avatar asked Feb 16 '26 23:02

user3512982


1 Answers

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.

like image 105
LB2 Avatar answered Feb 19 '26 13:02

LB2