File log implementation
Inheritance: ILog, System.IDisposable
Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 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();
            }
            
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
 public ATApplication(FileLog debugLog)
 {
     log_ = debugLog;
 }
Ejemplo n.º 5
0
        public void Dispose()
        {
            if (socketReader_ != null)
            {
                socketReader_.Dispose();
                socketReader_ = null;
            }

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