Ejemplo n.º 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_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
        }
Ejemplo n.º 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
        }