当前位置: 首页>>代码示例>>C#>>正文


C# log4net.ILog.Fatal方法代码示例

本文整理汇总了C#中log4net.ILog.Fatal方法的典型用法代码示例。如果您正苦于以下问题:C# log4net.ILog.Fatal方法的具体用法?C# log4net.ILog.Fatal怎么用?C# log4net.ILog.Fatal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在log4net.ILog的用法示例。


在下文中一共展示了log4net.ILog.Fatal方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AudioManager

        public AudioManager(bool hardware = true)
        {
            _log = Logging.LogManager.GetLogger(this);
            _log.Info("Initializing AudioManager...");
            _log.Info("Creating FMOD system...");
            uint version = 0;

            RESULT result = Factory.System_Create(ref _system);
            ErrCheck(result);

            _log.Debug("Checking FMOD version...");
            result = _system.getVersion(ref version);
            ErrCheck(result);

            if (version < VERSION.number)
            {
                var msg = string.Format("Error! You are using an old version of FMOD: {0}. This program requires: {1}.",
                                        version.ToString("X"), VERSION.number.ToString("X"));
                _log.Fatal(msg);
                throw new FMODException(msg);
            }

            result = _system.init(MaxChannels, INITFLAGS.NORMAL, (IntPtr) null);
            ErrCheck(result);

            _soundManager = new SoundManager(_system, hardware);
            _songManager = new SongManager(_system, hardware);

            _log.Info("AudioManager initialized!");
        }
开发者ID:Sharparam,项目名称:DiseasedToast,代码行数:30,代码来源:AudioManager.cs

示例2: WriteLog

        public void WriteLog(LogEnum name, LogLevel level, string logContent)
        {
            log = log4net.LogManager.GetLogger(name.ToString());
            //log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            switch (level)
            {
                case LogLevel.DEBUG:
                    log.Debug(logContent);
                    break;
                case LogLevel.ERROR:
                    log.Error(logContent);
                    break;
                case LogLevel.FATAL:
                    log.Fatal(logContent);
                    break;
                case LogLevel.INFO:
                    log.Info(logContent);
                    break;
                case LogLevel.WARN:
                    log.Warn(logContent);
                    break;
                default:
                    log.Debug(logContent);
                    break;
            }
        }
开发者ID:mmxftp,项目名称:JSMiracle.AutoWarehouse,代码行数:27,代码来源:Net4Log.cs

示例3: IceManager

        public IceManager(string adapterName, string host, int port, bool catchSignals = true)
        {
            IceGridHost = host;
            IceGridPort = port;
            Name = adapterName;

            logger = log4net.LogManager.GetLogger(this.GetType().Name + "::" + Name);

            _ServantIds = new List<Ice.Identity>(); //keep track of servants for emergency cleanup
            string myIP = findLocalIPAddress();
            logger.Info("My IPAddress is: " + myIP);

            //initialize Ice
            Ice.Properties prop = Ice.Util.createProperties();
            prop.setProperty("hms.AdapterId", adapterName);
            prop.setProperty("hms.Endpoints", "tcp -h " + myIP + ":udp -h " + myIP);
            prop.setProperty("Ice.Default.Locator", "IceGrid/Locator:tcp -p " + IceGridPort + " -h " + IceGridHost);
            prop.setProperty("Ice.ThreadPool.Server.Size", "5");
            prop.setProperty("Ice.ThreadPool.Server.SizeMax", "100000");
            prop.setProperty("Ice.ThreadPool.Client.Size", "5");
            prop.setProperty("Ice.ThreadPool.Client.SizeMax", "100000");

            Ice.InitializationData iceidata = new Ice.InitializationData();
            iceidata.properties = prop;
            Communicator = Ice.Util.initialize(iceidata); // could add sys.argv
            try
            {
                _Adapter = Communicator.createObjectAdapter("hms");
                _Adapter.activate();
            }
            catch (Exception ex)
            {
                logger.Fatal("Network error, check configuration: " + ex.Message);
                logger.Fatal("Endpoint(should be local machine): " + prop.getProperty("hms.Endpoints"));
                logger.Fatal("Locator (should be IceGrid Server): " + prop.getProperty("Ice.Default.Locator"));
                throw (ex); // we are dead anyway
            }
            //Now are we ready to communicate with others
            //getting usefull proxies

            try
            {
                // proxy to icegrid to register our vc devices
                Query = IceGrid.QueryPrxHelper.checkedCast(Communicator.stringToProxy("IceGrid/Query"));
                if (Query == null)
                {
                    logger.Error("invalid ICeGrid proxy");
                }
                // proxy to icestorm to publish events
                EventMgr = IceStorm.TopicManagerPrxHelper.checkedCast(Communicator.stringToProxy("EventServer/TopicManager"));
                if (EventMgr == null)
                {
                    logger.Error("invalid IceStorm proxy");
                }
                //these 2 objects are only needed to get the IceGrid admin object in order to register
                _Registry = IceGrid.RegistryPrxHelper.uncheckedCast(Communicator.stringToProxy("IceGrid/Registry"));
                updateIceGridAdmin();

            }
            catch (Ice.NotRegisteredException e)
            {
                logger.Fatal("If we fail here it is probably because the Icebox objects are not registered: " + e.Message);
            }
            catch (Exception e)
            {
                logger.Fatal("IceGrid Server not found!!!!!: " + e.Message);
                throw (e);//without yellow page system, there is no need to start
            }
            if (catchSignals)
            {
                setupSignals();
            }
        }
开发者ID:SintefRaufossManufacturing,项目名称:icehms,代码行数:73,代码来源:icehms.cs

示例4: Main


//.........这里部分代码省略.........
                    
    //<Corporations>
    //  <IPAddress from="" to="" value="" />
    //</Corporations>

                    

                    Dictionary<string, XmlContainer> dict = new Dictionary<string, XmlContainer>();

                    logger.Info("开始读设备表!");

                        IList<Device> devices = Device.FindBy<Device>(null);

                        logger.Info("读设备表完成,开始处理!");


                        foreach (Device dev in devices)
                        {
                            XmlContainer xmlContainer = null;
                            switch (dev.Catalog)
                            {
                                case 1: //交换机
                                    logger.InfoFormat("开始处理交换机{0}:{1}:{2}!", dev.Id, dev.Address, dev);
                                    xmlContainer = processSW(dev, dict);
                                    break;
                                case 2://路由器
                                    logger.InfoFormat("开始处理路由器{0}:{1}:{2}!", dev.Id, dev.Address, dev);
                                    xmlContainer = processRT(dev, dict);
                                    break;
                                case 3://交换路由器
                                    logger.InfoFormat("开始处理交换路由器{0}:{1}:{2}!", dev.Id, dev.Address, dev);
                                    xmlContainer = processSW(dev, dict);
                                    break;
                                default:
                                    logger.InfoFormat("跳过未知设备{0}:{1}:{2}!", dev.Id, dev.Address, dev);
                                    break;
                            }

                            if (null != xmlContainer)
                            {
                                _deviceByIds[dev.Id] = dev;
                                clearXml(xmlContainer, dict);
                            }

                        }

                        logger.Info("处理设备表完成,开始读线路表!");

                        using (linkLogger = new StreamWriter(Path.Combine(basePath, string.Concat("nanrui.modul.link.txt"))))
                        {
                            IList<Link> links = Link.FindBy<Link>(null);
                            logger.Info("读线路表完成,开始处理!");

                            foreach (Link link in links)
                            {
                                logger.InfoFormat("开始处理线路{0}:{1}!", link.Id, link);

                                XmlContainer xmlContainer = processLink(link, dict);

                                clearXml(xmlContainer, dict);


                                if (null != xmlContainer)
                                {
                                    _linkByIds[link.Id] = link;
                                    clearXml(xmlContainer, dict);
                                }
                            }
                        }
                        linkLogger = null;

                        logger.Info("处理线路表完成, 开始发送数据!");

                        foreach (XmlContainer xmlContainer in dict.Values)
                        {

                            XmlNode node = xmlContainer.Doc.SelectSingleNode("/IMSDATA/datas[@classname=\"RelationShip\"]");
                            if (null != node)
                            {
                                XmlNode parentNode = node.ParentNode;
                                parentNode.RemoveChild(node);
                                parentNode.AppendChild(node);
                            }

                            Send(xmlContainer.Doc, xmlContainer.Doc.OuterXml);
                        }
                    
                        logger.Info("数据处理完成,配置发送程序退出!");
                }
                catch (Exception e)
                {
                    logger.Fatal("发生异常!", e);
                }

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
开发者ID:Redi0,项目名称:meijing-ui,代码行数:101,代码来源:Program.cs

示例5: MainGame

        public MainGame()
        {
            _log = LogManager.GetLogger(this);

            Activated += GameActivated;
            Deactivated += GameDeactivated;

            _log.Debug("Setting initial FPS value");
            FPS = 0.0f;

            _log.Info("Setting graphics settings...");

            _graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth = ScreenWidth,
                PreferredBackBufferHeight = ScreenHeight
            };

            _log.Info(string.Format("Screen size set to: [W]{0} x [H]{1}", ScreenWidth, ScreenHeight));

            _graphics.SynchronizeWithVerticalRetrace = false;
            //IsFixedTimeStep = false;

            _graphics.ApplyChanges();

            ScreenRectangle = new Rectangle(0, 0, ScreenWidth, ScreenHeight);

            _log.Debug("Setting content root directory...");

            Content.RootDirectory = "Content";

            // Create necessary folders if they don't exist
            try
            {
                if (!Directory.Exists(Paths.SettingsFolder))
                    Directory.CreateDirectory(Paths.SettingsFolder);
            }
            catch (IOException ex)
            {
                _log.Error("Failed to create necessary game folders. Exception details as follows...");
                _log.Fatal("IOException: " + ex.Message + Environment.NewLine + "Details:", ex);
                _log.Fatal("Game will now exit...");
                Exit();
            }

            _log.Info("Loading controls...");
            ControlsManager = new ControlsManager();
            _log.Debug("Controls loaded!");

            _log.Info("Creating components...");

            AudioManager = new AudioManager();

            _stateManager = new GameStateManager(this);
            TitleScreen = new TitleScreen(this, _stateManager);
            StartMenuScreen = new StartMenuScreen(this, _stateManager);
            CharacterGeneratorScreen = new CharacterGeneratorScreen(this, _stateManager);
            SkillScreen = new SkillScreen(this, _stateManager);
            LoadGameScreen = new LoadGameScreen(this, _stateManager);
            GamePlayScreen = new GamePlayScreen(this, _stateManager);

            Components.Add(new InputHandler(this));
            Components.Add(_stateManager);

            _log.Info("Components created!");

            LoadMusic();

            var menuSong = AudioManager.Song.GetSong("MenuTheme");
            menuSong.SetStartFade(new FadeInfo(0.0f, 1.0f, 0.01f, TimeSpan.FromMilliseconds(20)));
            menuSong.SetEndFade(new FadeInfo(1.0f, 0.0f, 0.01f, TimeSpan.FromMilliseconds(15)));

            _log.Debug("Changing to TitleScreen...");
            _stateManager.ChangeState(TitleScreen);
        }
开发者ID:Sharparam,项目名称:DiseasedToast,代码行数:75,代码来源:MainGame.cs

示例6: Main

        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            #if DEBUG
            bool debug = true;
            #else
            bool debug = false;
            #endif
            if (args.Length > 0)
                if (args[0].ToLower() == "debug")
                    debug = true;

            if (string.IsNullOrEmpty(Thread.CurrentThread.Name))
                Thread.CurrentThread.Name = "Main";

            if (debug && !System.Diagnostics.Debugger.IsAttached)
            {
                AllocConsole();
                IntPtr stdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
                var safeFileHandle = new SafeFileHandle(stdHandle, true);
                var fileStream = new FileStream(safeFileHandle, FileAccess.Write);
                var encoding = System.Text.Encoding.GetEncoding(CODE_PAGE);
                var stdOut = new StreamWriter(fileStream, encoding) {AutoFlush = true};
                Console.SetOut(stdOut);
            }

            LogManager.LoadConfig(debug);
            _log = LogManager.GetLogger(typeof (Program));
            _log.Info("!!! APPLICATION LOAD !!!");
            _log.Info("Detecting components...");
            foreach (var file in Directory.GetFiles(Directory.GetCurrentDirectory()))
            {
                string ext = Path.GetExtension(file);
                if (string.IsNullOrEmpty(ext))
                    continue;
                ext = ext.Substring(1);
                if (ext == "dll" || ext == "exe")
                {
                    string version = AssemblyName.GetAssemblyName(file).Version.ToString();
                    string name = Path.GetFileNameWithoutExtension(file);
                    _log.Info(name + " v" + version);
                }
            }

            _log.Info("Components detected!");
            _log.Info("Sharpcraft is loading...");

            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (!Directory.Exists(Constants.SettingsDirectory))
                    Directory.CreateDirectory(Constants.SettingsDirectory);

            #if SC_DIRECT
                new Sharpcraft(null).Run();
            #else
                _log.Debug("Starting launcher...");
                _launcher = new Launcher();
                _launcher.Show();
                _context = new ApplicationContext(_launcher);
                Application.Run(_context);
                _log.Info("Launcher has returned execution to main thread.");
            #endif
            }
            catch(FileNotFoundException ex)
            {
                _log.Fatal("Required file \"" + ex.FileName + "\" not found! Application is exiting...");
            }
            catch(IOException ex)
            {
                _log.Fatal("IO Operation failed: " + ex.Message);
                _log.Fatal("Application is exiting...");
            }
            catch(Exception ex)
            {
                UnhandledExceptionHandler(null, new UnhandledExceptionEventArgs(ex, false));
            #if DEBUG
                throw;
            #endif
            }
            finally
            {
                if (_launcher != null)
                {
                    _log.Debug("Closing launcher.");
                    _launcher.Close();
                    _launcher.Dispose();
                    _launcher = null;
                    _log.Info("Launcher closed.");
                }
                if (debug)
                {
                    _log.Debug("Closing debug console.");
                    FreeConsole();
                }
                _log.Info("!!! APPLICATION EXIT !!!");
            }
        }
开发者ID:SijmenSchoon,项目名称:Sharpcraft,代码行数:100,代码来源:Program.cs


注:本文中的log4net.ILog.Fatal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。