开发者

LOG4NET: pass dynamic value to appender

开发者 https://www.devze.com 2023-04-13 08:02 出处:网络
After instantiating the logger, I would like to pass a value back to log4net based upon the results of my code.For instance, if a method returns a value of \"ABC Report\", I would like to pass tha开发

After instantiating the logger, I would like to pass a value back to log4net based upon the results of my code. For instance, if a method returns a value of "ABC Report", I would like to pass tha开发者_StackOverflow中文版t back to the appender and append it to the 'value' of the .

Thanks in advance!


Your question is not very clear...

Do you mean that you want to do something like this:

var logger = LogManager.GetLogger(your logger name goes here);

logger.Info("Hello!);

int sum = 1 + 2;

logger.InfoFormat("the sum is {0}", sum);

When you call the log4net logging methods, you are passing the "values" to log4net that you want log4net to log.

Are you trying to do something different? If you can, try to make your question more clear. Don't just add your clarification as a comment.

0

精彩评论

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

关注公众号