Example #1
0
        public RollingFileAppenderConfiguration Merge(DefaultAppenders appenders)
        {
            try
            {
                var default_appender = appenders.RollingFileAppender;

                if (default_appender != null)
                {
                    base.Merge(default_appender);

                    if (string.IsNullOrEmpty(Path))
                    {
                        Path = default_appender.Path;
                    }

                    if (string.IsNullOrEmpty(FileName))
                    {
                        if (!string.IsNullOrEmpty(default_appender.FileName))
                        {
                            FileName = default_appender.FileName;
                        }
                        else
                        {
                            FileName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name + ".log";
                        }
                    }

                    if (string.IsNullOrEmpty(RollFileExistsBehavior))
                    {
                        RollFileExistsBehavior = default_appender.RollFileExistsBehavior;
                    }

                    if (string.IsNullOrEmpty(RollInterval))
                    {
                        RollInterval = default_appender.RollInterval;
                    }

                    if (string.IsNullOrEmpty(RollSizeKB))
                    {
                        RollSizeKB = default_appender.RollSizeKB;
                    }

                    if (string.IsNullOrEmpty(TimeStampPattern))
                    {
                        TimeStampPattern = default_appender.TimeStampPattern;
                    }

                    if (string.IsNullOrEmpty(MaxArchivedFiles))
                    {
                        MaxArchivedFiles = default_appender.MaxArchivedFiles;
                    }
                }

                return(this);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public ConsoleAppenderConfiguration Merge(DefaultAppenders appenders)
        {
            try
            {
                var default_appender = appenders.ConsoleAppender;

                if (default_appender != null)
                {
                    base.Merge(default_appender);
                }

                return(this);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }