Ejemplo n.º 1
0
 /// <summary>Logs a message if the message LogLevel exceeds this log level floor.</summary>
 /// <param name="message">A Argix08.TraceMessage message.</param>
 public static void WriteLine(TraceMessage message)
 {
     //Send to the listeners if the log level exceeds the severity level set for this instance
     if (message.EventLogLevel >= LogLevelFloor)
     {
         Trace.WriteLine(message);
     }
     Trace.Flush();
 }
Ejemplo n.º 2
0
        private string formatMessage(TraceMessage msg)
        {
            //
            StringBuilder preamble = new StringBuilder();

            preamble.Append(DateTime.Now.ToString() + "\t");
            preamble.Append(msg.Source + "\t");
            preamble.Append(msg.Message + "\t");
            preamble.Append(msg.EventLogLevel.ToString() + "\t");
            return(preamble.ToString());
        }
Ejemplo n.º 3
0
 /// <summary>Logs a message if the message LogLevel exceeds this log level floor.</summary>
 /// <param name="message">A message object that derives from Argix08.TraceMessage.</param>
 public override void WriteLine(object message)
 {
     //Write message to database log if event level is severe enough
     try {
         TraceMessage tm = (TraceMessage)message;
         if (tm.EventLogLevel >= this.mLogLevelFloor)
         {
             writeToLog(tm);
         }
     }
     catch (Exception ex) { throw new ApplicationException("Unexpected error while logging trace message (::WriteLine(object)).", ex); }
 }
Ejemplo n.º 4
0
        public static void WriteLogEntry(TraceMessage m)
        {
            //Write an entry into the Argix log
            RateQuoteServiceClient client = new RateQuoteServiceClient();

            try {
                //client.WriteLogEntry(m);
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ConfigurationFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
        }
Ejemplo n.º 5
0
        private void writeToLog(TraceMessage msg)
        {
            //Write trace message to database log
            string sSource   = (msg.Source.Length <= 30) ? msg.Source : msg.Source.Substring(0, 30);
            string sKeyData1 = (msg.KeyData1.Length <= 30) ? msg.KeyData1 : msg.KeyData1.Substring(0, 30);
            string sKeyData2 = (msg.KeyData2.Length <= 30) ? msg.KeyData2 : msg.KeyData2.Substring(0, 30);
            string sKeyData3 = (msg.KeyData3.Length <= 30) ? msg.KeyData3 : msg.KeyData3.Substring(0, 30);
            string sMessage  = (msg.Message.Length <= 300) ? msg.Message : msg.Message.Substring(0, 300);

            sMessage = sMessage.Replace("\\n", " ");
            sMessage = sMessage.Replace("\r", "");
            sMessage = sMessage.Replace("\n", "");
            this.mMediator.ExecuteNonQuery(this.mLogSPName, new object[] { this.mLogEntryName, Convert.ToInt32(msg.EventLogLevel), DateTime.Now, sSource, "None", "0", Environment.UserName, Environment.MachineName, sKeyData1, sKeyData2, sKeyData3, sMessage });
        }
Ejemplo n.º 6
0
        public void WriteLogEntry(TraceMessage m)
        {
            //Get the operating enterprise terminal
            KronosClient _Client = null;

            try {
                _Client = new KronosClient();
                _Client.WriteLogEntry(m);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("WriteLogEntry() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("WriteLogEntry() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("WriteLogEntry() communication error.", ce); }
        }
Ejemplo n.º 7
0
 public static void Trace(string message, LogLevel level)
 {
     //Trace
     if (level >= _Config.TraceLevel)
     {
         TraceMessage m = new TraceMessage();
         m.Name     = "Argix10";
         m.Source   = App.Product;
         m.User     = Environment.UserName;
         m.Computer = Environment.MachineName;
         m.LogLevel = level;
         m.Message  = message;
         TsortGateway.WriteLogEntry(m);
     }
 }
Ejemplo n.º 8
0
        public static void Trace(string message, LogLevel level)
        {
            //Trace
            //if((int)level >= _Config.TraceLevel) {
            TraceMessage m = new TraceMessage();

            m.Name     = "Argix08";
            m.Source   = App.Product;
            m.User     = Environment.UserName;
            m.Computer = Environment.MachineName;
            m.LogLevel = level;
            m.Message  = message;
            RateWareProxy.WriteLogEntry(m);
            //}
        }
Ejemplo n.º 9
0
        public void WriteLogEntry(TraceMessage m)
        {
            //Write o to database log if event level is severe enough
            try {
                if (m.LogLevel >= this.mLogLevelFloor)
                {
                    string message = (m.Message != null) ? m.Message : "";
                    message = message.Replace("\\n", " ");
                    message = message.Replace("\r", "");
                    message = message.Replace("\n", "");
                    string category = (m.Category != null) ? m.Category : "";
                    string _event   = (m.Event != null) ? m.Event : "";
                    string keyData1 = (m.Keyword1 != null) ? m.Keyword1 : "";
                    string keyData2 = (m.Keyword2 != null) ? m.Keyword2 : "";
                    string keyData3 = (m.Keyword3 != null) ? m.Keyword3 : "";

                    new DataService().ExecuteNonQuery(this.mConnectionID, USP_LOG_NEW, new object[] { m.Name, Convert.ToInt32(m.LogLevel), DateTime.Now, m.Source, category, _event, m.User, m.Computer, keyData1, keyData2, keyData3, message });
                }
            }
            catch { }
        }
Ejemplo n.º 10
0
        public static void Trace(string message, LogLevel level)
        {
            //Trace
            TraceMessage m = new TraceMessage();

            m.Name     = "Argix08";
            m.Source   = App.Product;
            m.User     = Environment.UserName;
            m.Computer = Environment.MachineName;
            m.LogLevel = level;
            m.Message  = message;
            AppServiceClient appLog = new AppServiceClient();

            try {
                appLog.WriteLogEntry(m);
                appLog.Close();
            }
            catch (TimeoutException ex) { appLog.Abort(); ReportError(ex, true, LogLevel.None); }
            catch (CommunicationException ex) { appLog.Abort(); ReportError(ex, true, LogLevel.None); }
            catch (Exception ex) { appLog.Abort(); ReportError(ex, true, LogLevel.None); }
        }
Ejemplo n.º 11
0
        public void WriteLogEntry(TraceMessage m)
        {
            //Write o to database log if event level is severe enough
            try {
                if (m.LogLevel >= this.mLogLevelFloor)
                {
                    string message = (m.Message != null) ? m.Message : "";
                    message = message.Replace("\\n", " ");
                    message = message.Replace("\r", "");
                    message = message.Replace("\n", "");
                    string category = (m.Category != null) ? m.Category : "";
                    string _event   = (m.Event != null) ? m.Event : "";
                    string keyData1 = (m.Keyword1 != null) ? m.Keyword1 : "";
                    string keyData2 = (m.Keyword2 != null) ? m.Keyword2 : "";
                    string keyData3 = (m.Keyword3 != null) ? m.Keyword3 : "";

                    executeNonQuery(USP_LOG_NEW, new object[] { m.Name, Convert.ToInt32(m.LogLevel), DateTime.Now, m.Source, category, _event, m.User, m.Computer, keyData1, keyData2, keyData3, message });
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while logging trace message.", ex); }
        }
Ejemplo n.º 12
0
 public static void WriteLogEntry(TraceMessage m)
 {
     new AppService(SQL_CONNID).WriteLogEntry(m);
 }