daily pastebin goal
18%
SHARE
TWEET

Exception catching with NLog

amironov73 Jan 20th, 2017 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. using ManagedClient;
  4.  
  5. using NLog;
  6.  
  7. class Program
  8. {
  9.     public static Logger MyLogger = LogManager.GetCurrentClassLogger();
  10.  
  11.     static void Main()
  12.     {
  13.         try
  14.         {
  15.             string connectionString = "host=127.0.0.1;port=6666;user=1;password=1";
  16.  
  17.             using (ManagedClient64 client = new ManagedClient64())
  18.             {
  19.                 client.ParseConnectionString(connectionString);
  20.                 client.Connect();
  21.  
  22.                 int maxMfn = client.GetMaxMfn();
  23.                 Console.WriteLine("Max MFN={0}", maxMfn);
  24.             }
  25.         }
  26.         catch (Exception exception)
  27.         {
  28.             MyLogger.Error(exception, "Some useful description");
  29.         }
  30.     }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top