private void Init(TOptions options)
        {
            Application.AddDefines(options.Defines);

            var projName      = Assembly.GetEntryAssembly().GetName().Name.Replace(".", " - ");
            var componentName = GetComponentName(options);

            Console.Title = $"{projName}, {componentName}";

            string logsDirectory =
                Path.GetFullPath(options.Log.IsNotEmptyString() ? options.Log : GetLogsDirectory(options));

            EventStoreLoggerConfiguration.Initialize(logsDirectory, componentName);

            Log.Information("\n{description,-25} {version} ({branch}/{hashtag}, {timestamp})", "ES VERSION:",
                            VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp);
            Log.Information("{description,-25} {osFlavor} ({osVersion})", "OS:", OS.OsFlavor, Environment.OSVersion);
            Log.Information("{description,-25} {osRuntimeVersion} ({architecture}-bit)", "RUNTIME:",
                            OS.GetRuntimeVersion(),
                            Marshal.SizeOf(typeof(IntPtr)) * 8);
            Log.Information("{description,-25} {maxGeneration}", "GC:",
                            GC.MaxGeneration == 0
                                        ? "NON-GENERATION (PROBABLY BOEHM)"
                                        : $"{GC.MaxGeneration + 1} GENERATIONS");
            Log.Information("{description,-25} {logsDirectory}", "LOGS:", logsDirectory);

            Log.Information(EventStoreOptions.DumpOptions());

            if (options.WhatIf)
            {
                Application.Exit(ExitCode.Success, "WhatIf option specified");
            }
        }
Beispiel #2
0
        private void Init(TOptions options)
        {
            Application.AddDefines(options.Defines);

            var projName      = Assembly.GetEntryAssembly().GetName().Name.Replace(".", " - ");
            var componentName = GetComponentName(options);

            Console.Title = string.Format("{0}, {1}", projName, componentName);

            string logsDirectory = Path.GetFullPath(options.Log.IsNotEmptyString() ? options.Log : GetLogsDirectory(options));

            LogManager.Init(componentName, logsDirectory, Locations.DefaultConfigurationDirectory);

            Log.Info("\n{0,-25} {1} ({2}/{3}, {4})\n"
                     + "{5,-25} {6} ({7})\n"
                     + "{8,-25} {9} ({10}-bit)\n"
                     + "{11,-25} {12}\n"
                     + "{13,-25} {14}\n\n"
                     + "{15}",
                     "ES VERSION:", VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp,
                     "OS:", OS.OsFlavor, Environment.OSVersion,
                     "RUNTIME:", OS.GetRuntimeVersion(), Marshal.SizeOf(typeof(IntPtr)) * 8,
                     "GC:", GC.MaxGeneration == 0 ? "NON-GENERATION (PROBABLY BOEHM)" : string.Format("{0} GENERATIONS", GC.MaxGeneration + 1),
                     "LOGS:", LogManager.LogsDirectory,
                     EventStoreOptions.DumpOptions());

            if (options.WhatIf)
            {
                Application.Exit(ExitCode.Success, "WhatIf option specified");
            }
        }
        private void Init(TOptions options)
        {
            Application.AddDefines(options.Defines);

            var projName      = Assembly.GetEntryAssembly().GetName().Name.Replace(".", " - ");
            var componentName = GetComponentName(options);

            Console.Title = string.Format("{0}, {1}", projName, componentName);

            string logsDirectory = Path.GetFullPath(options.Log.IsNotEmptyString() ? options.Log : GetLogsDirectory(options));
            bool   structuredLog = GetIsStructuredLog(options);

            LogManager.Init(componentName, logsDirectory, structuredLog, Locations.DefaultConfigurationDirectory);

            Log.Info("\n{description,-25} {version} ({branch}/{hashtag}, {timestamp})", "ES VERSION:", VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp);
            Log.Info("{description,-25} {osFlavor} ({osVersion})", "OS:", OS.OsFlavor, Environment.OSVersion);
            Log.Info("{description,-25} {osRuntimeVersion} ({architecture}-bit)", "RUNTIME:", OS.GetRuntimeVersion(), Marshal.SizeOf(typeof(IntPtr)) * 8);
            Log.Info("{description,-25} {maxGeneration}", "GC:", GC.MaxGeneration == 0 ? "NON-GENERATION (PROBABLY BOEHM)" : string.Format("{0} GENERATIONS", GC.MaxGeneration + 1));
            Log.Info("{description,-25} {logsDirectory}", "LOGS:", LogManager.LogsDirectory);
            if (!structuredLog)
            {
                Log.Info("{esOptions}", EventStoreOptions.DumpOptions());
            }
            else
            {
                Log.Info("{@esOptions}", EventStoreOptions.DumpOptionsStructured());
            }

            if (options.WhatIf)
            {
                Application.Exit(ExitCode.Success, "WhatIf option specified");
            }
        }
        public void SetUp()
        {
            System.Net.ServicePointManager.DefaultConnectionLimit = 1000;
            Console.WriteLine("Initializing tests (setting console loggers)...");
            SetUpDebugListeners();

            var originalFormatter = NLog.Config.ConfigurationItemFactory.Default.ValueFormatter;

            ConfigurationItemFactory.Default.ValueFormatter = new NLogValueFormatter(originalFormatter, false);
            ConsoleTarget consoleTarget = new ConsoleTarget("testconsole");
            var           config        = new NLog.Config.LoggingConfiguration();

            config.AddRule(LogLevel.Trace, LogLevel.Fatal, consoleTarget);
            consoleTarget.Layout          = "[${processid:padCharacter=0:padding=5},${threadid:padCharacter=0:padding=2},${date:universalTime=true:format=HH\\:mm\\:ss\\.fff},${level:padding=-5:uppercase=true}] ${message}${onexception:${newline}${literal:text=EXCEPTION OCCURRED}${newline}${exception:format=message}}";
            NLog.LogManager.Configuration = config;
            EventStore.Common.Log.LogManager.SetLogFactory(x => new NLogger(x));

            Application.AddDefines(new[] { Application.AdditionalCommitChecks });
            LogEnvironmentInfo();

            if (!Debugger.IsAttached)
            {
                PortsHelper.InitPorts(IPAddress.Loopback);
            }
        }
Beispiel #5
0
        public void SetUp()
        {
            Console.WriteLine("Initializing tests (setting console loggers)...");
            LogManager.SetLogFactory(x => new ConsoleLogger());
            Application.AddDefines(new[] { Application.AdditionalCommitChecks });
            LogEnvironmentInfo();

            if (!Debugger.IsAttached)
            {
                PortsHelper.InitPorts(IPAddress.Loopback);
            }
        }
Beispiel #6
0
        public void SetUp()
        {
            System.Net.ServicePointManager.DefaultConnectionLimit = 1000;
            Console.WriteLine("Initializing tests (setting console loggers)...");
            SetUpDebugListeners();
            LogManager.SetLogFactory(x => new ConsoleLogger());
            Application.AddDefines(new[] { Application.AdditionalCommitChecks });
            LogEnvironmentInfo();

            if (!Debugger.IsAttached)
            {
                PortsHelper.InitPorts(IPAddress.Loopback);
            }
        }
 public void SetUp()
 {
     ServicePointManager.DefaultConnectionLimit = 1000;
     Application.AddDefines(new[] { Application.AdditionalCommitChecks });
     LogEnvironmentInfo();
 }