private static void Main(string[] args) { XmlConfigurator.Configure(); var stopWatch = new Stopwatch(); stopWatch.Start(); for (int i = 0; i < nTicks; i++) { //log.Info("A tick! Value: 2, Unit: Bytes, Unit: Kilobytes"); log.Info("A tick! Value: 29.4 Kilobytes"); //log.Info("A tick! Value: 0 Kilobytes"); //log.Info(String.Format("A tick! Timestamp: {0}", DateTimeOffset.Now.AddMinutes(-10).ToString())); //log.Info(null); //log.Info("A tick! %logger %metadata{instanceid}"); log.Info(new AWSAppender.CloudWatch.Model.MetricDatum("A tick!") //.WithTimestamp(DateTimeOffset.Now.AddMinutes(-10)) .WithUnit("Kilobytes") .WithValue(29.4)); } stopWatch.Stop(); Console.WriteLine("All {0} ticks in {1} ms.\nWaiting for requests to complete.", nTicks, stopWatch.ElapsedMilliseconds); stopWatch.Start(); ServiceTasks.WaitForPendingRequests(); stopWatch.Stop(); Console.WriteLine("Requests completed in {0} ms.", stopWatch.ElapsedMilliseconds); }
private static void Main(string[] args) { XmlConfigurator.Configure(); var streams = new[] { "Stream1", "Stream2" }; var groups = new[] { "GRoup1", "GRaoup2" }; var random = new Random(); var stopWatch = new Stopwatch(); stopWatch.Start(); for (int i = 0; i < nTicks; i++) { //log.Info("A tick! Value: 2, Unit: Bytes, Unit: Kilobytes"); if (random.Next(2) == 0) { log.InfoFormat("A tick! Groupname: {0} Streamname: {1} Gauge: {2}", groups[random.Next(2)], streams[random.Next(2)], random.Next(200)); } else { log.Info(new LogDatum("A tick!") { GroupName = groups[random.Next(2)], StreamName = streams[random.Next(2)], Timestamp = DateTime.UtcNow }); } log.Info("Message: sample text for logging"); Thread.Sleep(10); } ILoggerRepository rep = LogManager.GetRepository(); foreach (IAppender appender in rep.GetAppenders()) { var buffered = appender as BufferingAppenderSkeleton; if (buffered != null) { buffered.Flush(); } } stopWatch.Stop(); Console.WriteLine("All {0} ticks in {1} ms.\nWaiting for requests to complete.", nTicks, stopWatch.ElapsedMilliseconds); stopWatch.Start(); ServiceTasks.WaitForPendingRequests(); stopWatch.Stop(); Console.WriteLine("Requests completed in {0} ms.", stopWatch.ElapsedMilliseconds); }
private static void Main(string[] args) { XmlConfigurator.Configure(); var stopWatch = new Stopwatch(); stopWatch.Start(); for (int i = 0; i < nTicks; i++) { log.Info("A log event"); } stopWatch.Stop(); Console.WriteLine(String.Format("All {0} ticks in {1} ms.\nWaiting for requests to complete.", nTicks, stopWatch.ElapsedMilliseconds)); stopWatch.Start(); ServiceTasks.WaitForPendingRequests(); stopWatch.Stop(); Console.WriteLine(String.Format("Requests completed in {0} ms.", stopWatch.ElapsedMilliseconds)); }
private static void Main(string[] args) { XmlConfigurator.Configure(); var queues = new[] { "Queue1", "Queue2" }; var random = new Random(); var stopWatch = new Stopwatch(); stopWatch.Start(); for (int i = 0; i < nTicks; i++) { //log.Info("A tick! Value: 2, Unit: Bytes, Unit: Kilobytes"); switch (random.Next(4)) { case 0: log.InfoFormat("A tick! Queuename: {0} ID: {1}", "queue0", random.NextDouble().ToString(CultureInfo.InvariantCulture).Replace(".", "")); break; case 1: log.InfoFormat("A tick! Queuename: {0} ID: {1} DelaySeconds: {2}", "queue1", random.NextDouble().ToString(CultureInfo.InvariantCulture).Replace(".", ""), random.Next(10)); break; case 2: log.Info(new SQSDatum("A tick!") { QueueName = "queue2", ID = random.NextDouble().ToString(CultureInfo.InvariantCulture).Replace(".", "") }); break; case 3: log.Info(new SQSDatum("A tick!") { QueueName = "queue3", ID = random.NextDouble().ToString(CultureInfo.InvariantCulture).Replace(".", ""), DelaySeconds = random.Next(10) + 10 }); break; } //Thread.Sleep(10); } ILoggerRepository rep = LogManager.GetRepository(); foreach (IAppender appender in rep.GetAppenders()) { var buffered = appender as BufferingAppenderSkeleton; if (buffered != null) { buffered.Flush(); } } stopWatch.Stop(); Console.WriteLine("All {0} ticks in {1} ms.\nWaiting for requests to complete.", nTicks, stopWatch.ElapsedMilliseconds); stopWatch.Start(); ServiceTasks.WaitForPendingRequests(); stopWatch.Stop(); Console.WriteLine("Requests completed in {0} ms.", stopWatch.ElapsedMilliseconds); }
private static void Main(string[] args) { XmlConfigurator.Configure(); var dims = new[] { "TestDimenValue1", "TestDimenValue2" }; var names = new[] { "TestName1", "TestName2" }; var nss = new[] { "TestNameSpace1", "TestNameSpace2" }; var units = new[] { "Kilobytes", "Megabytes", "Gigabytes" }; var random = new Random(); var stopWatch = new Stopwatch(); stopWatch.Start(); for (int i = 0; i < nTicks; i++) { //log.Info("A tick! Value: 2, Unit: Bytes, Unit: Kilobytes"); if (random.Next(2) == 0) { log.InfoFormat("A tick! Namespace: {1} MetricCOMMENTName: {2} Dimension: TestDim: {3} Value: {0} {4}", random.NextDouble() * (1e5 - 1e2) + 1e2, nss[random.Next(2)], names[random.Next(2)], dims[random.Next(2)], units[random.Next(3)]); } else { log.Info(new CloudWatchAppender.Model.MetricDatum("A tick!") { NameSpace = nss[random.Next(2)], Dimensions = { new Dimension { Name = "TestDim", Value = dims[random.Next(2)] } }, //MetricName = names[random.Next(2)], Unit = units[random.Next(3)], StatisticValues = new StatisticSet { Minimum = random.NextDouble() * (3e3 - 1e2) + 1e2, Maximum = random.NextDouble() * (1.1e5 - .9e4) + .9e4, Sum = (random.NextDouble() * (6e4 - 4e4) + 4e4) * 100, SampleCount = 100 } }); } Thread.Sleep(10); } ILoggerRepository rep = LogManager.GetRepository(); foreach (IAppender appender in rep.GetAppenders()) { var buffered = appender as BufferingAppenderSkeleton; if (buffered != null) { buffered.Flush(); } } stopWatch.Stop(); Console.WriteLine("All {0} ticks in {1} ms.\nWaiting for requests to complete.", nTicks, stopWatch.ElapsedMilliseconds); stopWatch.Start(); ServiceTasks.WaitForPendingRequests(); stopWatch.Stop(); Console.WriteLine("Requests completed in {0} ms.", stopWatch.ElapsedMilliseconds); }