public CountryVM Get(int id) { CountryVM model = null; using (CountryOperation operation = new CountryOperation()) { model = new CountryVM { Country = operation.Get(id) }; } try { model.Flag = File.ReadAllBytes(AppConfig.FlagPath + string.Format(model.Country.Flag, AppConfig.FlagResolution)); } catch (DirectoryNotFoundException e) { Log4NetManager.Error("Bayrak klasörü bulunamadı", e); } catch (FileNotFoundException e) { Log4NetManager.Error("Bayrak dosyası bulunamadı", e); } return(model); }
protected void Application_Start() { Log4NetManager.InitializeLog4Net(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Application["OnlineUsers"] = 0; }
static void Main() { Log4NetManager.InitializeFromAppConfig(); #if NETCOREAPP3_1 Application.SetHighDpiMode(HighDpiMode.SystemAware); #endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
static MvcApplication() { Log4NetManager.InitializeFromAppConfig(); LOGGER = LogManager.GetLogger(typeof(MvcApplication)); if (LOGGER.IsDebugEnabled) { LOGGER.Debug(string.Format("GLOBAL_ASAX, Process private memory consumption: {0} byte(s)", Process.GetCurrentProcess().PrivateMemorySize64.ToString("### ### ### ###"))); } LogUtils.LogAll(); if (LOGGER.IsDebugEnabled) { LOGGER.Debug(string.Format("GLOBAL_ASAX, Process private memory consumption: {0} byte(s)", Process.GetCurrentProcess().PrivateMemorySize64.ToString("### ### ### ###"))); } }
static void Main(string[] args) { Log4NetManager.InitializeFromAppConfig(); //LogManager.LOGGER = Log4NetManager.Instance; //XmlDocument log4netConfig = new XmlDocument(); //log4netConfig.Load(File.OpenRead(System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath)); //var repo = log4net.LogManager.CreateRepository(Assembly.GetEntryAssembly(), // typeof(log4net.Repository.Hierarchy.Hierarchy)); //log4net.Config.XmlConfigurator.Configure(repo, (XmlElement)log4netConfig.GetElementsByTagName("log4net")[0]); FireEvent fe = new FireEvent(); fe.OnTest += Fe_OnTest; fe.Fire(); Console.ReadLine(); }
static void Main(string[] args) { // initializing logger Log4NetManager.InitializeFromAppConfig(); LOGGER = LogManager.GetLogger(typeof(Program)); LogUtils.LogAll(); Console.WriteLine("Running tests..."); Program p = new Program(); p.Initialize(); p.RunTestCalls(); p.Shutdown(); Console.WriteLine("Press Enter to exit..."); Console.ReadLine(); }
public ExecuteResult Execute([FromBody] CountryVM model) { try { using (CountryOperation operation = new CountryOperation()) { switch (model.OperationType) { case OperationType.Save: string flagName = model.Country.Code + "-{0}.png"; model.Country.Flag = flagName; operation.Save(model.Country); File.WriteAllBytes(AppConfig.FlagPath + string.Format(flagName, AppConfig.FlagResolution), model.Flag); break; case OperationType.Update: model.Country.Flag = operation.GetFlagName(model.Country.Id); operation.Update(model.Country); File.WriteAllBytes(AppConfig.FlagPath + string.Format(model.Country.Code + "-{0}.png", AppConfig.FlagResolution), model.Flag); break; case OperationType.Delete: operation.Delete(model.Country); break; } return(new ExecuteResult { Succeeded = true, ResultMessage = "İşleminiz gerçekleştirilmiştir." }); } } catch (System.Exception ex) { Log4NetManager.Error("İşlem sırasında hata alındı.", ex); return(new ExecuteResult { Succeeded = false, ResultMessage = "Beklenmedik bir hata oluştu." }); } }
public MainWindow() { Log4NetManager.InitializeFromAppConfig(); InitializeComponent(); test.TestEvent += Test_TestEvent; }
public PrismLogger() { logger = Log4NetManager.GetLogger("HomeAutomationTester"); }