Exemplo n.º 1
0
        public static LogMessage CreateHandleLogEntity(string logType, string iKey)
        {
            var handlelog = new LogMessage
            {
                Ikey     = iKey,
                Username = "******",
                Module   = "nomodule",
                LogType  = logType,
                Content  = "nocontent",
                IsHandle = false,
                Keyword  = "nokeyword",
                OrderNo  = "noorderno",
                ClientIP = ClientHelper.GetClientIP(),
                ServerIP = IPHelper.GetLocalIP(),
            };

            if (string.IsNullOrEmpty(iKey))
            {
                handlelog.Ikey = Guid.NewGuid().ToString();
            }
            return(handlelog);
        }
Exemplo n.º 2
0
        static DBLog()
        {
            try
            {
                m_localLog = LoggerSource.Instance.GetLogger(typeof(DBLog));

                AppSetting.InitDistributionConfig();
                m_logToServer   = AppSetting.LogToServer;
                m_localServer   = ServerManager.GetLocalServer();
                m_localServerIP = IPHelper.GetLocalIP();

                m_localServerCode = m_localServer != null ? m_localServer.ServerCode : m_localServerIP;
                if (m_openLogCenter)
                {
#if THRIFT
                    ZKManager.Client.Init();
                    InitThriftServer();
#endif
                }

                m_request = RegisterService.TaskRequestService.GetService(m_logToServer);

                m_logHandlePool = new DataBufferPool(BatchSendHandleRequest)
                {
                    AutoFlushLogSeconds = 5,
                    IsBlockMainThread   = false
                };
                m_logProcessPool = new DataBufferPool(BatchSendProcessRequest)
                {
                    AutoFlushLogSeconds = 3,
                    IsBlockMainThread   = false
                };
            }
            catch (Exception ex)
            {
                m_localLog.Error(ex);
            }
        }