Index: trunk/BNS/bns.cpp
===================================================================
--- trunk/BNS/bns.cpp	(revision 811)
+++ trunk/BNS/bns.cpp	(revision 812)
@@ -55,4 +55,12 @@
     _outFile = new QTextStream(&outFile);
   }
+
+  // Log File
+  // --------
+  _logFile   = 0;
+  QFile logFile(settings.value("logFile").toString());
+  if (logFile.open(QFile::WriteOnly | QFile::Truncate)) {
+    _logFile = new QTextStream(&logFile);
+  }
 }
 
@@ -64,4 +72,6 @@
   ///  delete _clkSocket;
   delete _outSocket;
+  delete _outFile;
+  delete _logFile;
   QMapIterator<QString, t_ephPair*> it(_ephList);
   while (it.hasNext()) {
@@ -85,5 +95,7 @@
 ////////////////////////////////////////////////////////////////////////////
 void t_bns::slotMessage(const QByteArray msg) {
-  cout << msg.data() << endl;
+  if (_logFile) {
+    *_logFile << msg << endl;
+  }
   emit(newMessage(msg));
 }
@@ -92,5 +104,7 @@
 ////////////////////////////////////////////////////////////////////////////
 void t_bns::slotError(const QByteArray msg) {
-  cerr << msg.data() << endl;
+  if (_logFile) {
+    *_logFile << msg << endl;
+  }
   deleteBnsEph();
   emit(error(msg));
Index: trunk/BNS/bns.h
===================================================================
--- trunk/BNS/bns.h	(revision 811)
+++ trunk/BNS/bns.h	(revision 812)
@@ -53,4 +53,5 @@
   QTcpSocket*               _outSocket;
   QTextStream*              _outFile;
+  QTextStream*              _logFile;
   t_bnseph*                 _bnseph;
   QMutex                    _mutex;
