Ejemplo n.º 1
0
        public static IReadOnlyList <ILogAppender> GetDefaultAppenders()
        {
            if (_defaultAppenders == null)
            {
                lock (typeof(LogManager))
                    if (_defaultAppenders == null)
                    {
                        var ev = GlobalEvent.Fire(new LogEvent.CreateDefaultAppender(new List <ILogAppender>
                        {
                            GetFileAppender(GetDefaultLogFolder(), AppUtils.GetApplicationName(),
                                            false)
                        }));
                        _defaultAppenders = ev.Appenders;
                    }
            }

            return(_defaultAppenders);
        }
Ejemplo n.º 2
0
        public static string GetDefaultLogFolder()
        {
            if (_defaultLogFolder == null)
            {
                lock (typeof(LogManager))
                    if (_defaultLogFolder == null)
                    {
                        var folder  = AppUtils.GetApplicationProduct() ?? "app";
                        var appdata = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                        if (appdata != null)
                        {
                            folder = Path.Combine(appdata, folder);
                        }
                        var ev = GlobalEvent.Fire(new LogEvent.GetDefaultLogFolder {
                            Folder = folder
                        });
                        _defaultLogFolder = ev.Folder ?? folder;
                    }
            }

            return(_defaultLogFolder);
        }