Exemple #1
0
        public static void Main(string[] args)
        {
            LogbusClientConfiguration config = new LogbusClientConfiguration
            {
                endpoint = new LogbusEndpointDefinition
                {
                    basePath = "http://localhost:8065",
                    suffix   = ".asmx"
                }
            };
            XmlSerializer seria = new XmlSerializer(typeof(LogbusClientConfiguration), "http://www.dis.unina.it/logbus-ng/configuration/2.0");

            seria.Serialize(Console.Out, config, config.xmlns);
            if (File.Exists("output.txt"))
            {
                File.Delete("output.txt");
            }
            using (StreamWriter sw = new StreamWriter(new FileStream("output.txt", FileMode.CreateNew), Encoding.UTF8))
            {
                seria.Serialize(sw, config, config.xmlns);
            }


            Console.WriteLine();

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        public void MyTestInitialize()
        {
            LogbusServerConfiguration coreConfig = new LogbusServerConfiguration
            {
                inchannels = new[]
                {
                    new InboundChannelDefinition {
                        type = "SyslogTlsReceiver"
                    }
                },
                webserver = new WebServerConfiguration {
                    active = true
                }
            };

            ConfigurationHelper.ServerConfiguration = coreConfig;
            LogbusClientConfiguration clientConfig = new LogbusClientConfiguration
            {
                endpoint = new LogbusEndpointDefinition {
                    basePath = "http://localhost:8065/", suffix = ".asmx"
                }
            };

            ConfigurationHelper.ClientConfiguration = clientConfig;

            LogbusLoggerConfiguration loggerConfig = new LogbusLoggerConfiguration
            {
                collector = new[]
                {
                    new LogbusCollectorDefinition
                    {
                        id    = "tls", type = "SyslogTlsCollector",
                        param =
                            new[] { new KeyValuePair {
                                        name = "host", value = "localhost"
                                    } }
                    }
                },
                defaultcollector = "tls"
            };

            ConfigurationHelper.SourceConfiguration = loggerConfig;
        }