LOG4NET: pass dynamic value to appender
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.
精彩评论