using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Couchbase; using Couchbase.Configuration.Client; using Couchbase.Tracing; using log4net; using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; namespace ForumQuestions { class Program { static void Main(string[] args) { LoggerFactory loggerFactory = new LoggerFactory(); loggerFactory.AddNLog(new NLogProviderOptions { CaptureMessageTemplates = true, CaptureMessageProperties = true }); NLog.LogManager.LoadConfiguration("nlog.config"); // loggerFactory.AddLog4Net("log4net.config"); // var tracer = new ThresholdLoggingTracer { KvThreshold = 1, // 1 ms N1qlThreshold = 1, SearchThreshold = 1, SampleSize = int.MaxValue, Interval = 1000 // 1 second }; var cluster = new Cluster(new ClientConfiguration { LoggerFactory = loggerFactory, Tracer = tracer, Servers = new List { new Uri("http://localhost:8091")}, }); cluster.Authenticate("Administrator", "password"); var bucket = cluster.OpenBucket("tests"); var id = Guid.NewGuid().ToString(); var response = bucket.Insert(id, new {foo = "bar"}); if (!response.Success) throw new Exception(response.Message); cluster.Dispose(); } } }