Beispiel #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            const string genlogfilename = "ShinkenStartlog.txt";
            // Default (and const) values...
            const string logfileconffilename = "Shinken_Broker";

            DirectLog.WriteFileEntry(genlogfilename, "Shinken Broker log configuration step...", DirectLog.LogLevel.Info);
            // Set a log file if specified into the configuration file
            NameValueCollection appSettings = ConfigurationManager.AppSettings;
            string logconf_filename         = appSettings[logfileconffilename];

            if (logconf_filename != null)
            {
                // For a windows service, the current dir is %WINDIR%\SYSTEM32, so we have
                // to change all the .\ or the relative path with the application startup path
                string currentconf = Application.StartupPath + @"\" + logconf_filename;
                DirectLog.WriteFileEntry(genlogfilename, "Shinken Broker logging conf set to " + currentconf, DirectLog.LogLevel.Info);
                XmlConfigurator.Configure(new System.IO.FileInfo(currentconf));
            }
#if DEBUG
            ShinkenBroker_Service ShinkenBroker = new ShinkenBroker_Service();
            ShinkenBroker.DirectStart();
#else
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new ShinkenBroker_Service()
            };

            // Run the set of services
            DirectLog.WriteFileEntry(genlogfilename, "Shinken Broker starting...", DirectLog.LogLevel.Info);
            ServiceBase.Run(ServicesToRun);
#endif
        }
Beispiel #2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            const string genlogfilename = "ShinkenStartlog.txt";
            // Default (and const) values...
            const string logfileconffilename = "Shinken_Arbiter";

            DirectLog.WriteFileEntry(genlogfilename, "Shinken Arbiter log configuration step...", DirectLog.LogLevel.Info);
            // Set a log file if specified into the configuration file
            NameValueCollection appSettings = ConfigurationManager.AppSettings;
            string logconf_filename         = appSettings[logfileconffilename];

            if (logconf_filename != null)
            {
                // This settings is relative... So we have to put the codebase because
                // a service don't use relative paths..
                string currentconf = Application.StartupPath + @"\" + logconf_filename;
                DirectLog.WriteFileEntry(genlogfilename, "Shinken Arbiter logging conf set to " + currentconf, DirectLog.LogLevel.Info);
                XmlConfigurator.Configure(new System.IO.FileInfo(currentconf));
            }
#if DEBUG
            ShinkenArbiter_Service ShinkenArbiter = new ShinkenArbiter_Service();
            ShinkenArbiter.DirectStart();
#else
            ServiceBase[] ServicesToRun;

            ServicesToRun = new ServiceBase[]
            {
                new ShinkenArbiter_Service()
            };
            DirectLog.WriteFileEntry(genlogfilename, "Shinken Arbiter starting...", DirectLog.LogLevel.Info);
            // Run the set of services
            ServiceBase.Run(ServicesToRun);
#endif
        }
Beispiel #3
0
 public LoggerAnonymousInnerClass4(DirectLog outerInstance)
 {
     this.outerInstance = outerInstance;
 }