protected override void Append(LoggingEvent loggingEvent) { _loggingEvent = loggingEvent; // append the level message and the content to one string //string message = string.Format("{0}, {1}", //loggingEvent.Level.DisplayName, //loggingEvent.RenderedMessage); LogServiceMessage message = new LogServiceMessage() { TransDate = DateTime.Now, LogLevel = LogLevel, LogingName = LogingName, OICUserId = OICUserId, DeptCode = DeptCode, CompanyCode = CompanyCode, SystemCode = SystemCode, SubSystemCode = SubSystemCode, PrgId = PrgId, IpAddress = IPAddress, LogHeader = LogHeader, Detail = Detail, CreateDate = CreatedDate, CreateBy = CreatedBy }; if (loggingEvent.ExceptionObject != null) { message.LogException = loggingEvent.ExceptionObject.Message; } // send this string message to wcf service Service.NewLog(message); }
private void SettingProperties(object[] args, String header, String exception = "") { if ((args != null && args.Length > 0) && (args[0]).GetType() == typeof(LogServiceMessage)) { LogServiceMessage logMessage = (LogServiceMessage)args[0]; log4net.LogicalThreadContext.Properties["login_name"] = logMessage.LogingName; log4net.LogicalThreadContext.Properties["oic_userid"] = logMessage.OICUserId; log4net.LogicalThreadContext.Properties["dept_code"] = logMessage.DeptCode; log4net.LogicalThreadContext.Properties["company_code"] = logMessage.CompanyCode; log4net.LogicalThreadContext.Properties["system_code"] = logMessage.SystemCode; log4net.LogicalThreadContext.Properties["subsystem_code"] = logMessage.SubSystemCode; log4net.LogicalThreadContext.Properties["prg_id"] = logMessage.PrgId; log4net.LogicalThreadContext.Properties["ip_address"] = logMessage.IpAddress; log4net.LogicalThreadContext.Properties["log_header"] = logMessage.LogHeader; log4net.LogicalThreadContext.Properties["log_exception"] = logMessage.LogException; log4net.LogicalThreadContext.Properties["created_by"] = logMessage.CreateBy; } else { log4net.LogicalThreadContext.Properties["login_name"] = ""; log4net.LogicalThreadContext.Properties["oic_userid"] = ""; log4net.LogicalThreadContext.Properties["dept_code"] = ""; log4net.LogicalThreadContext.Properties["company_code"] = ""; log4net.LogicalThreadContext.Properties["system_code"] = SystemCode; log4net.LogicalThreadContext.Properties["subsystem_code"] = SubSystemCode; log4net.LogicalThreadContext.Properties["prg_id"] = PrgId; log4net.LogicalThreadContext.Properties["ip_address"] = IPAddress; log4net.LogicalThreadContext.Properties["log_header"] = header; log4net.LogicalThreadContext.Properties["log_exception"] = exception; log4net.LogicalThreadContext.Properties["created_by"] = ""; } }
public LogServiceMessage GetLogMessage(Int32 logLevel, String detail) { LogServiceMessage message = new LogServiceMessage() { TransDate = DateTime.Now, LogLevel = logLevel, LogingName = "INFO", OICUserId = "----", DeptCode = "----", CompanyCode = "-aa", SystemCode = "SORIA", SubSystemCode = "SORIA_BACK", PrgId = "PROGRAM", IpAddress = "192.168.16.23", LogHeader = "INFO", Detail = detail, CreateDate = DateTime.Now, CreateBy = "aaaa" }; return(message); }
private void SettingsChanged() { ApplicationSettings.SetValue("AppDataLogPath", this._logingDirectory); LogServiceMessage.SendLogServiceMessage(this.LogingDirectory, LogServiceMessage.MessageType.LogSettingPathChanged); SystemMessage.SendSystemMessage(SystemMessage.Type.Info, "Log Directory", "Log directory changed: " + this.LogingDirectory); }