File log implementation
Inheritance: ILog, System.IDisposable
 public ClientHandlerThread(TcpClient tcpClient, long clientId)
 {
     log_ = new FileLog("log", new SessionID("ClientHandlerThread", clientId.ToString(), "Debug")); /// FIXME
     tcpClient_ = tcpClient;
     id_ = clientId;
     socketReader_ = new SocketReader(tcpClient_, this);
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                System.Console.WriteLine("usage: AcceptanceTest CONFIG_FILENAME");
                System.Environment.Exit(2);
            }

            FileLog debugLog = new FileLog("log", new SessionID("AT", "Application", "Debug")); 
            ThreadedSocketAcceptor acceptor = null;
            try
            {
                ATApplication testApp = new ATApplication(debugLog);
                testApp.StopMeEvent += new System.Action(delegate() { _stopMe = true; });
                
                SessionSettings settings = new SessionSettings(args[0]);
                IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
                ILogFactory logFactory = null;
                if (settings.Get().Has("Verbose") && settings.Get().GetBool("Verbose"))
                    logFactory = new FileLogFactory(settings);
                acceptor = new ThreadedSocketAcceptor(testApp, storeFactory, settings, logFactory);

                acceptor.Start();
                while (true)
                {
                    System.Console.WriteLine("o hai "+System.DateTime.Now.ToString());
                    System.Threading.Thread.Sleep(1000);

                    // for tests of logout
                    if (_stopMe)
                    {
                        // this doesn't seem to work
                        // after stop, it doesn't seem to start up again
                        /*
                        acceptor.Stop();
                        Thread.Sleep(5 * 1000);
                        _stopMe = false;
                        acceptor.Start();
                         */
                    }
                }
            }
            catch (System.Exception e)
            {
                debugLog.OnEvent(e.ToString());
            }

            finally
            {
                if(acceptor != null)
                    acceptor.Stop();
            }
            
        }
        /// <summary>
        /// Creates a ClientHandlerThread
        /// </summary>
        /// <param name="tcpClient"></param>
        /// <param name="clientId"></param>
        /// <param name="debugLogFilePath">path where thread log will go</param>
        public ClientHandlerThread(TcpClient tcpClient, long clientId, QuickFix.Dictionary settingsDict, SocketSettings socketSettings)
        {
            string debugLogFilePath = "log";
            if (settingsDict.Has(SessionSettings.DEBUG_FILE_LOG_PATH))
                debugLogFilePath = settingsDict.GetString(SessionSettings.DEBUG_FILE_LOG_PATH);
            else if (settingsDict.Has(SessionSettings.FILE_LOG_PATH))
                debugLogFilePath = settingsDict.GetString(SessionSettings.FILE_LOG_PATH);

            // FIXME - do something more flexible than hardcoding a filelog
            log_ = new FileLog(debugLogFilePath, new SessionID("ClientHandlerThread", clientId.ToString(), "Debug"));

            this.Id = clientId;
            socketReader_ = new SocketReader(tcpClient, socketSettings, this);
        }
Beispiel #4
0
 public ATApplication(FileLog debugLog)
 {
     log_ = debugLog;
 }
        public void Dispose()
        {
            if (socketReader_ != null)
            {
                socketReader_.Dispose();
                socketReader_ = null;
            }

            if (log_ != null)
            {
                log_.Dispose();
                log_ = null;
            }
        }
		protected QuickFIX42CommonApplication(QuickFIX42CommonProvider provider, string logFilePreffix) :base()
    {
      this.provider = provider;
			this.fileLog = new FileLog(logFilePreffix);
    }