Ejemplo n.º 1
0
        /// <summary>
        /// Initalizes the fix archiver instance.
        /// </summary>
        /// <param name="node">The parent <see cref="GeoTrackerNode" /> instance.</param>
        /// <param name="args">
        /// This implementation's settings come directly from the application
        /// configuration as described below.
        /// </param>
        /// <remarks>
        /// <note>
        /// <para>
        /// Note that some of the application log settings are loaded directly from the application's <b>LillTek.AppLog</b>
        /// configuration settings section as described in <see cref="AppLog" />.  The valid arguments passed to the
        /// <see cref="Start" /> are:
        /// </para>
        /// <list type="table">
        ///     <item>
        ///         <term><b>LogName</b></term>
        ///         <description>
        ///         The name of the application log.  This defaults to <b>GeoTrackerFixes</b>.
        ///         </description>
        ///     </item>
        ///     <item>
        ///         <term><b>MaxSize</b></term>
        ///         <description>
        ///         The approximate maximum size of the log on disk or zero for no limit.
        ///         This defaults to <b>5GB</b>.
        ///         </description>
        ///     </item>
        ///     <item>
        ///         <term><b>PurgeInterval</b></term>
        ///         <description>
        ///         The interval at which the log will purge old log files so that the
        ///         total log size remains within the <b>MaxSize</b> limit.
        ///         This defaults to <b>5 minutes</b>.
        ///         </description>
        ///     </item>
        /// </list>
        /// <see cref="IGeoFixArchiver" /> implementations must silently handle any internal
        /// error conditions.  <see cref="GeoTrackerNode" /> does not expect to see any
        /// exceptions raised from calls to any of these methods.  Implementations should
        /// catch any exceptions thrown internally and log errors or warnings as necessary.
        /// </note>
        /// </remarks>
        public void Start(GeoTrackerNode node, ArgCollection args)
        {
            lock (syncLock)
            {
                try
                {
                    if (this.logWriter != null)
                    {
                        throw new InvalidOperationException("AppLogGeoFixArchiver: Archiver has already been started.");
                    }

                    if (this.isStopped)
                    {
                        throw new InvalidOperationException("AppLogGeoFixArchiver: Cannot restart a stopped archiver.");
                    }

                    this.node                    = node;
                    this.logName                 = args.Get("LogName", "GeoTrackerFixes");
                    this.maxSize                 = args.Get("MaxSize", 5L * 1024L * 1024L * 1024L);
                    this.purgeInterval           = args.Get("PurgeInterval", TimeSpan.FromMinutes(5));
                    this.logWriter               = new AppLogWriter(logName, SchemaName, SchemaVersion, maxSize);
                    this.logWriter.PurgeInterval = purgeInterval;
                }
                catch (Exception e)
                {
                    SysLog.LogException(e);
                }
            }
        }
Ejemplo n.º 2
0
        public void AppLog_Purge_Uncommitted()
        {
            string config =
                @"
&section LillTek.AppLog

RootFolder         = {0}
MaxFileSize        = 4096
BufferSize         = 128K
IdleCommitInterval = 5m

&endsection
";

            string       root   = TestFolder;
            string       folder = root + "\\AppLogs";
            AppLogWriter writer = null;

            Helper.CreateFolderTree(root);

            try
            {
                Config.SetConfig(string.Format(config, folder).Replace('&', '#'));
                folder += "\\Test";

                // Verify that the writer deletes any existing *.new files
                // before it gets started.

                Helper.CreateFolderTree(folder);

                new FileStream(folder + "\\test1.new", FileMode.Create).Close();
                new FileStream(folder + "\\test2.new", FileMode.Create).Close();
                new FileStream(folder + "\\test3.new", FileMode.Create).Close();
                Assert.AreEqual(3, Directory.GetFiles(folder, "*.new").Length);

                writer = AppLogWriter.Open("Test", "my schema", new Version("1.2.3.4"), 0);

                Assert.AreEqual(1, Directory.GetFiles(folder, "*.new").Length);

                writer.Close();

                Assert.AreEqual(0, Directory.GetFiles(folder, "*.new").Length);
                Assert.AreEqual(0, Directory.GetFiles(folder, "*.log").Length);
            }
            finally
            {
                Config.SetConfig(null);

                if (writer != null)
                {
                    writer.Close();
                }
            }

            DeleteFolder(root);
        }
Ejemplo n.º 3
0
        public void AppLog_Multiple_Writers()
        {
            string config =
                @"
&section LillTek.AppLog

RootFolder         = {0}
MaxFileSize        = 4096
BufferSize         = 128K
IdleCommitInterval = 5m

&endsection
";

            string       root   = TestFolder;
            string       folder = root + "\\AppLogs";
            AppLogWriter writer = null;

            Helper.CreateFolderTree(root);

            try
            {
                Config.SetConfig(string.Format(config, folder).Replace('&', '#'));
                folder += "\\Test";

                writer = AppLogWriter.Open("Test", "my schema", new Version("1.2.3.4"), 0);

                try
                {
                    AppLogWriter.Open("Test", "my schema", new Version("1.2.3.4"), 0);
                    Assert.Fail("Expected a LogException indicating multiple writers.");
                }
                catch (Exception e)
                {
                    Assert.AreEqual(typeof(LogException).Name, e.GetType().Name);
                }
            }
            finally
            {
                Config.SetConfig(null);

                if (writer != null)
                {
                    writer.Close();
                }
            }

            DeleteFolder(root);
        }
Ejemplo n.º 4
0
        public void AppLog_ReadWrite_DefaultLocation()
        {
            string       folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"LillTek\AppLogs\Test");
            AppLogWriter writer = null;
            AppLogReader reader = null;
            AppLogRecord rWrite, rRead;

            try
            {
                Helper.DeleteFile(folderPath, true);

                writer = AppLogWriter.Open("Test", "my schema", new Version("1.2.3.4"), 0);

                rWrite = new AppLogRecord();
                rWrite.Add("Foo", "Bar");
                writer.Write(rWrite);
                writer.Close();
                writer = null;

                reader = AppLogReader.Open("Test");
                rRead  = reader.Read();
                Assert.AreEqual(rWrite, rRead);
                Assert.AreEqual("my schema", rRead.SchemaName);
                Assert.AreEqual(new Version("1.2.3.4"), rRead.SchemaVersion);
                Assert.IsNull(reader.Read());
                Assert.IsNull(reader.Read());
                reader.Close();
                reader = null;

                Assert.IsTrue(Directory.Exists(folderPath));
            }
            finally
            {
                Config.SetConfig(null);

                if (writer != null)
                {
                    writer.Close();
                }

                if (reader != null)
                {
                    reader.Close();
                }

                Helper.DeleteFile(folderPath, true);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Performs any necessary shut down activites (flushing cached fixes, etc).
        /// </summary>
        /// <remarks>
        /// <note>
        /// <see cref="IGeoFixArchiver" /> implementations must silently handle any internal
        /// error conditions.  <see cref="GeoTrackerNode" /> does not expect to see any
        /// exceptions raised from calls to any of these methods.  Implementations should
        /// catch any exceptions thrown internally and log errors or warnings as necessary.
        /// </note>
        /// </remarks>
        public void Stop()
        {
            lock (syncLock)
            {
                try
                {
                    isStopped = true;

                    if (logWriter != null)
                    {
                        logWriter.Close();
                        logWriter = null;
                    }
                }
                catch (Exception e)
                {
                    SysLog.LogException(e);
                }
            }
        }
Ejemplo n.º 6
0
 public IReliableMessenger(AppLogWriter logWriter, AppLogReader logReader, ReliableMessengerConfig config)
 {
 }
Ejemplo n.º 7
0
        public void AppLog_ReadWrite_SpecificLocation()
        {
            string config =
                @"
&section LillTek.AppLog

RootFolder         = {0}
MaxFileSize        = 4096
BufferSize         = 128K
IdleCommitInterval = 5m

&endsection
";

            string       root = TestFolder;
            string       folder = root + "\\AppLogs";
            AppLogWriter writer = null;
            AppLogReader reader = null;
            AppLogRecord rWrite, rRead;

            Helper.CreateFolderTree(root);

            try
            {
                Config.SetConfig(string.Format(config, folder).Replace('&', '#'));
                folder += "\\Test";

                writer = AppLogWriter.Open("Test", "my schema", new Version("1.2.3.4"), 0);

                rWrite = new AppLogRecord();
                rWrite.Add("Foo", "Bar");
                writer.Write(rWrite);
                writer.Close();
                writer = null;

                reader = AppLogReader.Open("Test");
                rRead  = reader.Read();
                Assert.AreEqual(rWrite, rRead);
                Assert.AreEqual("my schema", rRead.SchemaName);
                Assert.AreEqual(new Version("1.2.3.4"), rRead.SchemaVersion);
                Assert.IsNull(reader.Read());
                Assert.IsNull(reader.Read());
                reader.Close();
                reader = null;
            }
            finally
            {
                Config.SetConfig(null);

                if (writer != null)
                {
                    writer.Close();
                }

                if (reader != null)
                {
                    reader.Close();
                }
            }

            DeleteFolder(root);
        }
Ejemplo n.º 8
0
        public void AppLog_Position_END()
        {
            string config =
                @"
&section LillTek.AppLog

RootFolder         = {0}
MaxFileSize        = 4096
BufferSize         = 128K
IdleCommitInterval = 5m

&endsection
";

            string       root   = TestFolder;
            string       folder = root + "\\AppLogs";
            AppLogWriter writer = null;
            AppLogReader reader = null;
            AppLogRecord r;

            byte[] data;
            string posEnd;

            data = new byte[2048];
            for (int i = 0; i < data.Length; i++)
            {
                data[i] = (byte)i;
            }

            Helper.CreateFolderTree(root);

            try
            {
                Config.SetConfig(string.Format(config, folder).Replace('&', '#'));
                folder += "\\Test";

                writer = AppLogWriter.Open("Test", "my schema", new Version("1.2.3.4"), 0);

                for (int i = 0; i < 10; i++)
                {
                    r = new AppLogRecord();
                    r.Add("Index", i.ToString());
                    r.Add("Data", data);
                    writer.Write(r);
                }

                writer.Commit();

                Assert.AreEqual(5, Directory.GetFiles(folder, "*.log").Length);
                Assert.AreEqual(1, Directory.GetFiles(folder, "*.new").Length);
                Assert.IsTrue(File.Exists(folder + "\\Writer.lock"));

                reader = AppLogReader.Open("Test");

                for (int i = 0; i < 10; i++)
                {
                    r = reader.ReadDelete();
                    Assert.AreEqual("my schema", r.SchemaName);
                    Assert.AreEqual(new Version("1.2.3.4"), r.SchemaVersion);

                    Assert.AreEqual(i.ToString(), r["index"]);
                    CollectionAssert.AreEqual(data, (byte[])r["data"]);
                }

                Assert.IsNull(reader.ReadDelete());
                Assert.IsNull(reader.ReadDelete());

                posEnd = reader.Position;

                r = new AppLogRecord();
                r.Add("Index", "10");
                r.Add("Data", data);
                writer.Write(r);
                writer.Commit();

                Assert.AreEqual(1, Directory.GetFiles(folder, "*.log").Length);

                reader.Position = posEnd;
                r = reader.Read();
                Assert.AreEqual("10", r["index"]);
                CollectionAssert.AreEqual(data, (byte[])r["data"]);
            }
            finally
            {
                Config.SetConfig(null);

                if (writer != null)
                {
                    writer.Close();
                }

                if (reader != null)
                {
                    reader.Close();
                }
            }

            DeleteFolder(root);
        }
Ejemplo n.º 9
0
        public void AppLog_Idle_Commit()
        {
            string config =
                @"
&section LillTek.AppLog

RootFolder         = {0}
MaxFileSize        = 4096
BufferSize         = 128K
IdleCommitInterval = 2s

&endsection
";

            string       root   = TestFolder;
            string       folder = root + "\\AppLogs";
            AppLogWriter writer = null;
            AppLogReader reader = null;
            AppLogRecord r;

            Helper.CreateFolderTree(root);

            try
            {
                Config.SetConfig(string.Format(config, folder).Replace('&', '#'));
                folder += "\\Test";

                writer = AppLogWriter.Open("Test", "my schema", new Version("1.2.3.4"), 0);

                r = new AppLogRecord();
                r.Add("Index", "1");
                writer.Write(r);

                Thread.Sleep(4000);     // Long enough for an idle commit
                Assert.AreEqual(1, Directory.GetFiles(folder, "*.log").Length);

                r = new AppLogRecord();
                r.Add("Index", "2");
                writer.Write(r);

                Thread.Sleep(4000);     // Long enough for an idle commit
                Assert.AreEqual(2, Directory.GetFiles(folder, "*.log").Length);

                reader = AppLogReader.Open("Test");

                r = reader.Read();
                Assert.AreEqual("1", r["index"]);

                r = reader.Read();
                Assert.AreEqual("2", r["index"]);

                Assert.IsNull(reader.Read());
                Assert.IsNull(reader.Read());
            }
            finally
            {
                Config.SetConfig(null);

                if (writer != null)
                {
                    writer.Close();
                }

                if (reader != null)
                {
                    reader.Close();
                }
            }

            DeleteFolder(root);
        }
Ejemplo n.º 10
0
        public void AppLog_Peek()
        {
            string config =
                @"
&section LillTek.AppLog

RootFolder         = {0}
MaxFileSize        = 4096
BufferSize         = 128K
IdleCommitInterval = 5m

&endsection
";

            string       root   = TestFolder;
            string       folder = root + "\\AppLogs";
            AppLogWriter writer = null;
            AppLogReader reader = null;
            AppLogRecord r;

            Helper.CreateFolderTree(root);

            try
            {
                Config.SetConfig(string.Format(config, folder).Replace('&', '#'));
                folder += "\\Test";

                writer = AppLogWriter.Open("Test", "my schema", new Version("1.2.3.4"), 0);

                r = new AppLogRecord();
                r.Add("index", "0");
                writer.Write(r);

                r = new AppLogRecord();
                r.Add("index", "1");
                writer.Write(r);

                r = new AppLogRecord();
                r.Add("index", "2");
                writer.Write(r);

                writer.Close();
                writer = null;

                //-----------------------------------------

                reader = AppLogReader.Open("Test");

                r = reader.Peek();
                Assert.AreEqual("0", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("0", (string)r["index"]);

                r = reader.Read();
                Assert.AreEqual("0", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("1", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("1", (string)r["index"]);

                r = reader.Read();
                Assert.AreEqual("1", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("2", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("2", (string)r["index"]);

                r = reader.Read();
                Assert.AreEqual("2", (string)r["index"]);

                Assert.IsNull(reader.Peek());
                Assert.IsNull(reader.Peek());
                Assert.IsNull(reader.Read());
                Assert.IsNull(reader.Read());

                reader.Close();
                reader = null;

                //-----------------------------------------

                reader          = AppLogReader.Open("Test");
                reader.Position = "BEGINNING";

                r = reader.ReadDelete();
                Assert.AreEqual("0", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("1", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("1", (string)r["index"]);

                r = reader.Read();
                Assert.AreEqual("1", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("2", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("2", (string)r["index"]);

                r = reader.Read();
                Assert.AreEqual("2", (string)r["index"]);

                Assert.IsNull(reader.Peek());
                Assert.IsNull(reader.Peek());
                Assert.IsNull(reader.Read());
                Assert.IsNull(reader.Read());

                reader.Close();
                reader = null;

                //-----------------------------------------

                reader          = AppLogReader.Open("Test");
                reader.Position = "BEGINNING";

                r = reader.Peek();
                Assert.AreEqual("1", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("1", (string)r["index"]);

                r = reader.Read();
                Assert.AreEqual("1", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("2", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("2", (string)r["index"]);

                r = reader.ReadDelete();
                Assert.AreEqual("2", (string)r["index"]);

                Assert.IsNull(reader.Peek());
                Assert.IsNull(reader.Peek());
                Assert.IsNull(reader.ReadDelete());
                Assert.IsNull(reader.ReadDelete());

                reader.Close();
                reader = null;

                //-----------------------------------------

                reader          = AppLogReader.Open("Test");
                reader.Position = "BEGINNING";

                r = reader.Peek();
                Assert.AreEqual("1", (string)r["index"]);

                r = reader.Peek();
                Assert.AreEqual("1", (string)r["index"]);

                r = reader.ReadDelete();
                Assert.AreEqual("1", (string)r["index"]);

                Assert.IsNull(reader.Peek());
                Assert.IsNull(reader.Peek());
                Assert.IsNull(reader.ReadDelete());
                Assert.IsNull(reader.ReadDelete());

                reader.Close();
                reader = null;

                //-----------------------------------------

                reader          = AppLogReader.Open("Test");
                reader.Position = "BEGINNING";

                Assert.IsNull(reader.Peek());
                Assert.IsNull(reader.Peek());
                Assert.IsNull(reader.Read());
                Assert.IsNull(reader.ReadDelete());

                reader.Close();
                reader = null;
            }
            finally
            {
                Config.SetConfig(null);

                if (writer != null)
                {
                    writer.Close();
                }

                if (reader != null)
                {
                    reader.Close();
                }
            }

            DeleteFolder(root);
        }
Ejemplo n.º 11
0
        public void AppLog_PersistReaderPos()
        {
            string config =
                @"
&section LillTek.AppLog

RootFolder         = {0}
MaxFileSize        = 4096
BufferSize         = 128K
IdleCommitInterval = 5m

&endsection
";

            string       root   = TestFolder;
            string       folder = root + "\\AppLogs";
            AppLogWriter writer = null;
            AppLogReader reader = null;
            AppLogRecord r;

            Helper.CreateFolderTree(root);

            try
            {
                Config.SetConfig(string.Format(config, folder).Replace('&', '#'));
                folder += "\\Test";

                writer = AppLogWriter.Open("Test", "my schema", new Version("1.2.3.4"), 0);

                for (int i = 0; i < 5; i++)
                {
                    r = new AppLogRecord();
                    r.Add("index", i.ToString());
                    writer.Write(r);
                }

                writer.Commit();

                for (int i = 5; i < 10; i++)
                {
                    r = new AppLogRecord();
                    r.Add("index", i.ToString());
                    writer.Write(r);
                }

                writer.Commit();

                for (int i = 0; i < 10; i++)
                {
                    reader = AppLogReader.Open("Test");

                    r = reader.Read();
                    Assert.AreEqual(i.ToString(), r["index"]);

                    reader.Close();
                    reader = null;
                }

                r = new AppLogRecord();
                r.Add("index", "10");
                writer.Write(r);
                writer.Commit();

                reader = AppLogReader.Open("Test");

                r = reader.Read();
                Assert.AreEqual("10", r["index"]);

                reader.Close();
                reader = null;

                writer.Close();
                writer = null;
            }
            finally
            {
                Config.SetConfig(null);

                if (writer != null)
                {
                    writer.Close();
                }

                if (reader != null)
                {
                    reader.Close();
                }
            }

            DeleteFolder(root);
        }
Ejemplo n.º 12
0
        public void AppLog_MaxLogSize()
        {
            // Verify that the log prunes log files to stay within the maximum log size.

            string config =
                @"
&section LillTek.AppLog

RootFolder         = {0}
MaxFileSize        = 4096
BufferSize         = 128K
IdleCommitInterval = 2s
PurgeInterval      = 2s

&endsection
";
            const long MaxLogSize = 10 * 1024 * 1024;  // 10MB

            string       root   = TestFolder;
            string       folder = root + "\\AppLogs";
            AppLogWriter writer = null;
            AppLogRecord record;

            byte[] data;
            long[] fileSizes;
            long   totalSize;

            Helper.CreateFolderTree(root);

            try
            {
                Config.SetConfig(string.Format(config, folder).Replace('&', '#'));
                folder += "\\Test";

                writer = new AppLogWriter("Test", "TestSchema", new Version("1.2.3.4"), MaxLogSize);

                // Write out ~50MB worth of log records and then wait a bit for the log
                // to perform the purge, and then scan the folder to make sure the total
                // size of all of the log files, except for the newest does not exceed
                // the limit.

                data = new byte[1024 * 1024];

                for (int i = 0; i < 50; i++)
                {
                    record         = new AppLogRecord();
                    record["data"] = data;

                    writer.Write(record);
                }

                Thread.Sleep(6000);

                var query =
                    from path in Directory.GetFiles(folder, "*.log", SearchOption.TopDirectoryOnly)
                    orderby path.ToLower() ascending
                    select new FileInfo(path).Length;

                fileSizes = query.ToArray();
                totalSize = 0;

                for (int i = 0; i < fileSizes.Length - 1; i++)
                {
                    totalSize += fileSizes[i];
                }

                Assert.IsTrue(totalSize <= MaxLogSize);
            }
            finally
            {
                Config.SetConfig(null);

                if (writer != null)
                {
                    writer.Close();
                }
            }

            DeleteFolder(root);
        }
Ejemplo n.º 13
0
        public void AppLog_RecordAvailableEvent()
        {
            string config =
                @"
&section LillTek.AppLog

RootFolder         = {0}
MaxFileSize        = 4096
BufferSize         = 128K
IdleCommitInterval = 5m

&endsection
";

            string       root   = TestFolder;
            string       folder = root + "\\AppLogs";
            AppLogWriter writer = null;
            AppLogReader reader = null;
            AppLogRecord r;

            Helper.CreateFolderTree(root);

            try
            {
                Config.SetConfig(string.Format(config, folder).Replace('&', '#'));
                folder += "\\Test";

                newRecords = false;

                writer = AppLogWriter.Open("Test", "my schema", new Version("1.2.3.4"), 0);
                reader = AppLogReader.Open("Test");
                reader.RecordAvailable += new LogRecordAvailableHandler(OnRecordAvailable);

                Assert.IsNull(reader.Read());

                r = new AppLogRecord();
                r.Add("foo", "bar");
                writer.Write(r);
                writer.Commit();

                Thread.Sleep(4000);     // Give the record available event a chance to be raised
                Assert.IsTrue(newRecords);

                r = reader.Read();
                Assert.AreEqual("bar", r["foo"]);
            }
            finally
            {
                Config.SetConfig(null);

                if (writer != null)
                {
                    writer.Close();
                }

                if (reader != null)
                {
                    reader.Close();
                }
            }

            DeleteFolder(root);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Archives a location fix for an entity.
        /// </summary>
        /// <param name="entityID">The entity identifier.</param>
        /// <param name="groupID">The group identifier or <c>null</c>.</param>
        /// <param name="fix">The location fix.</param>
        /// <remarks>
        /// <note>
        /// <see cref="IGeoFixArchiver" /> implementations must silently handle any internal
        /// error conditions.  <see cref="GeoTrackerNode" /> does not expect to see any
        /// exceptions raised from calls to any of these methods.  Implementations should
        /// catch any exceptions thrown internally and log errors or warnings as necessary.
        /// </note>
        /// </remarks>
        public void Archive(string entityID, string groupID, GeoFix fix)
        {
            lock (syncLock)
            {
                try
                {
                    if (isStopped)
                    {
                        throw new InvalidOperationException("AppLogGeoFixArchiver: Cannot log to a stopped archiver.");
                    }

                    if (logWriter == null)
                    {
                        logWriter = new AppLogWriter(logName, SchemaName, SchemaVersion, maxSize);
                        logWriter.PurgeInterval = purgeInterval;
                    }

                    var record = new AppLogRecord();

                    if (entityID != null)
                    {
                        record["EntityID"] = entityID;
                    }

                    if (groupID != null)
                    {
                        record["GroupID"] = groupID;
                    }

                    if (fix.TimeUtc.HasValue)
                    {
                        record["TimeUtc"] = fix.TimeUtc;
                    }

                    record["Technology"] = fix.Technology;

                    if (!double.IsNaN(fix.Latitude))
                    {
                        record["Latitude"] = fix.Latitude;
                    }

                    if (!double.IsNaN(fix.Longitude))
                    {
                        record["Longitude"] = fix.Longitude;
                    }

                    if (!double.IsNaN(fix.Altitude))
                    {
                        record["Altitude"] = fix.Altitude;
                    }

                    if (!double.IsNaN(fix.Course))
                    {
                        record["Course"] = fix.Course;
                    }

                    if (!double.IsNaN(fix.Speed))
                    {
                        record["Speed"] = fix.Speed;
                    }

                    if (!double.IsNaN(fix.HorizontalAccuracy))
                    {
                        record["HorizontalAccuracy"] = fix.HorizontalAccuracy;
                    }

                    if (!double.IsNaN(fix.VerticalAccurancy))
                    {
                        record["VerticalAccurancy"] = fix.VerticalAccurancy;
                    }

                    record["NetworkStatus"] = fix.NetworkStatus;

                    logWriter.Write(record);
                    node.IncrementFixesReceivedBy(1);
                }
                catch (Exception e)
                {
                    SysLog.LogException(e);
                }
            }
        }