CRM 2011 Appender for log4net

The CRM 2011 Appender is a custom appender for log4net. Instead of the basic file appender that writes log messages to a file, the CRM 2011 Appender will write log messages to your custom log entity inside your CRM 2011 organization. The advantage of the CRM 2011 Appender is t

C# (521.6 KB)
 
 
 
 
 
(3)
1,292 times
Add to favorites
5/7/2012
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • What is entity name where I will the logs
    1 Posts | Last post December 09, 2013
    • Will it create an entity called new_log?  After invoking the program, I do not see any new entity being created.  Where can I see my logs?
      
      
      
                  SetupLogging(service);
      
                  ILog log = LogManager.GetLogger(typeof(Program));
                  log.Info("Test"); 
      
      
      
             // This will programmatically setup the appender  
              //   or you can use the app.config to set it up there as well 
              private static void SetupLogging(IOrganizationService service)
              {
                  Crm2011Appender appender = new Crm2011Appender();
                  appender.Threshold = Level.Debug;
                  appender.Layout = new log4net.Layout.PatternLayout("%5level - %message%newline");
      
                  appender.OrganizationService = service;
                  appender.LogEntity = "new_log";
                  appender.MessageAttribute = "new_message";
                  appender.LevelAttribute = "new_level";
      
                  BasicConfigurator.Configure(appender);
              }