private IAppender GetUDPAppender(int?localport = null, int?remoteport = null, string remote_address = null)
        {
            var appender = new log4net.Appender.UdpAppender();

            if (localport == null)
            {
                localport = 4440;
            }
            appender.LocalPort = (int)localport;
            if (remoteport == null)
            {
                remoteport = 4445;
            }
            appender.RemotePort = (int)remoteport;
            if (remote_address == null)
            {
                remote_address = "255.255.255.255";
            }
            // remote_address = "192.168.1.33";
            var ip = IPAddress.Parse(remote_address);

            appender.RemoteAddress = ip;
            var layout = new P8XmlLayoutSchemaLog4j();

            layout.ActivateOptions();
            appender.Layout = layout;
            appender.ActivateOptions();
            return(appender);
        }
        private IAppender GetRollingAppender()
        {
            try
            {
                var level = Level.All;
                //var rollingFileAppenderLayout = new PatternLayout("%date{HH:mm:ss,fff}|T%2thread|%25.25logger|%5.5level| %message%newline");
                //rollingFileAppenderLayout.ActivateOptions();
                var layout = new P8XmlLayoutSchemaLog4j();
                layout.ActivateOptions();
                var rollingFileAppender = new RollingFileAppender();
                rollingFileAppender.Name         = "roller_appender";
                rollingFileAppender.Threshold    = level;
                rollingFileAppender.RollingStyle = RollingFileAppender.RollingMode.Date;
                //   rollingFileAppender.MaxFileSize = (int)ByteSizeLib.ByteSize.Parse("10MB").Bits;  //default
                //   rollingFileAppender.MaxSizeRollBackups = (int)ByteSizeLib.ByteSize.Parse("1GB").Bits;
                rollingFileAppender.CountDirection    = 0;
                rollingFileAppender.AppendToFile      = true;
                rollingFileAppender.LockingModel      = new FileAppender.MinimalLock();
                rollingFileAppender.StaticLogFileName = true;

                rollingFileAppender.DatePattern = ".yyyy-MM-dd'.log'";
                rollingFileAppender.Layout      = layout;
                rollingFileAppender.File        = Path.Combine(GetAndroidCommonPath(), "log.xml");
                rollingFileAppender.ActivateOptions();
                return(rollingFileAppender);
            }
            catch (Exception ex)
            {
            }
            return(null);
        }