Advertisement
amironov73

Exception catching with NLog

Jan 20th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement