Beispiel #1
0
        /// <summary>
        /// 获取配置信息
        /// </summary>
        /// <param name="log"></param>
        /// <returns></returns>
        MessageQueueConfig GetConfig(AccessInfo log)
        {
            foreach (AssessMQ mq in AccessConfig.Instance.LogServers)
            {
                foreach (var action in mq.Actions)
                {
                    if (string.Compare(log.Action, action) == 0)
                    {
                        return mq;
                    }
                }
            }

            return AccessConfig.Instance.DefaultLogServer;
        }
Beispiel #2
0
        /// <summary>
        /// 记录访问日志
        /// </summary>
        /// <param name="log"></param>
        public void Log(AccessInfo log)
        {
            try
            {
                MessageQueueConfig config = GetConfig(log);

                MessageQueueTools.SendMessage(
                    config.Address,
                    log, string.Empty, new BinaryMessageFormatter());
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }