diff --git a/CMakeLists.txt b/CMakeLists.txt
index ab02fea..2fcfb57 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,7 +27,6 @@ SET(CMAKE_FIND_LIBRARY_PREFIXES "")
 SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
 
 SET(STATIC_BUILD YES CACHE BOOL "Statically link the executable?")
-
 ################################################################################
 # Apple stuff
 ################################################################################
@@ -61,7 +60,7 @@ PROJECT(pgagent)
 # in pgagent.sql and upgrade_pgagent.sql if the major version number is
 # changed. The full version number also needs to be included in pgAgent.rc and
 # pgaevent/pgamsgevent.rc at present.
-SET(VERSION 3.4.0)
+SET(VERSION "3.4.0")
 
 # CPack stuff
 SET(CPACK_PACKAGE_VERSION_MAJOR 3)
@@ -79,6 +78,7 @@ SET(CPACK_SOURCE_GENERATOR TGZ)
 SET(CPACK_SOURCE_IGNORE_FILES "\\\\.DS_Store;/CVS/;/\\\\.svn/;\\\\.swp$;\\\\.#;/#;.*~;cscope.*")
 
 ADD_DEFINITIONS(-DPGAGENT_VERSION_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR})
+ADD_DEFINITIONS(-DPGAGENT_VERSION="${VERSION}")
 
 # This must come after we set the CPACK variables!!
 INCLUDE(CPack)
diff --git a/include/misc.h b/include/misc.h
index 14b4edc..6f1c7d3 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -18,6 +18,7 @@ void WaitAWhile(const bool waitLong = false);
 void setOptions(int argc, char **argv, const wxString &executable);
 wxString getArg(int &argc, char **&argv);
 wxString NumToStr(const long l);
+void printVersion();
 
 #endif // MISC_H
 
diff --git a/misc.cpp b/misc.cpp
index dfd56a0..4e07d81 100644
--- a/misc.cpp
+++ b/misc.cpp
@@ -16,6 +16,8 @@
 #include <unistd.h>
 #endif
 
+#define APPVERSION_STR wxT(PGAGENT_VERSION)
+
 // In unix.c or win32.c
 void usage(const wxString &executable);
 
@@ -42,6 +44,11 @@ wxString getArg(int &argc, char **&argv)
 	return s;
 }
 
+void printVersion()
+{
+	wxPrintf(_("PostgreSQL Scheduling Agent\n"));
+	wxPrintf(_("Version: %s\n"), APPVERSION_STR);
+}
 
 void setOptions(int argc, char **argv, const wxString &executable)
 {
@@ -72,6 +79,11 @@ void setOptions(int argc, char **argv, const wxString &executable)
 						minLogLevel = val;
 					break;
 				}
+				case 'v':
+				{
+					printVersion();
+					exit (0);
+				}
 #ifndef __WXMSW__
 				case 'f':
 				{
diff --git a/unix.cpp b/unix.cpp
index 34ad0f6..6bd6ad3 100644
--- a/unix.cpp
+++ b/unix.cpp
@@ -17,14 +17,17 @@
 #include <wx/filename.h>
 #include <wx/ffile.h>
 #include <fcntl.h>
+void printVersion();
 
 void usage(const wxString &executable)
 {
 	wxFileName *fn = new wxFileName(executable);
+	printVersion();
 
 	wxPrintf(_("Usage:\n"));
 	wxPrintf(fn->GetName() + _(" [options] <connect-string>\n"));
 	wxPrintf(_("options:\n"));
+	wxPrintf(_("-v (display version info and then exit)\n"));
 	wxPrintf(_("-f run in the foreground (do not detach from the terminal)\n"));
 	wxPrintf(_("-t <poll time interval in seconds (default 10)>\n"));
 	wxPrintf(_("-r <retry period after connection abort in seconds (>=10, default 30)>\n"));
@@ -50,22 +53,25 @@ void LogMessage(wxString msg, int level)
 		return;
 	}
 
+	wxDateTime logTime = wxDateTime::Now();
+	wxString logTimeString = logTime.Format() + wxT(" : ");
+
 	switch (level)
 	{
 		case LOG_DEBUG:
 			if (minLogLevel >= LOG_DEBUG)
-				file.Write(_("DEBUG: ") + msg + wxT("\n"));
+				file.Write(logTimeString + _("DEBUG: ") + msg + wxT("\n"));
 			break;
 		case LOG_WARNING:
 			if (minLogLevel >= LOG_WARNING)
-				file.Write(_("WARNING: ") + msg + wxT("\n"));
+				file.Write(logTimeString + _("WARNING: ") + msg + wxT("\n"));
 			break;
 		case LOG_ERROR:
-			file.Write(_("ERROR: ") + msg + wxT("\n"));
+			file.Write(logTimeString + _("ERROR: ") + msg + wxT("\n"));
 			exit(1);
 			break;
 		case LOG_STARTUP:
-			file.Write(_("WARNING: ") + msg + wxT("\n"));
+			file.Write(logTimeString + _("WARNING: ") + msg + wxT("\n"));
 			break;
 	}
 
diff --git a/win32.cpp b/win32.cpp
index aa5d5d7..720aa87 100644
--- a/win32.cpp
+++ b/win32.cpp
@@ -36,6 +36,7 @@ static HANDLE serviceSync;
 static HANDLE eventHandle;
 
 bool stopService();
+void printVersion();
 
 // This will be called from MainLoop, if pgagent is initialized properly
 void Initialized()
@@ -435,12 +436,14 @@ bool removeService(const wxString &serviceName)
 void usage(const wxString &executable)
 {
 	wxFileName *fn = new wxFileName(executable);
+	printVersion();
 
 	wxPrintf(_("Usage:\n"));
 	wxPrintf(fn->GetName() + _(" REMOVE <serviceName>\n"));
 	wxPrintf(fn->GetName() + _(" INSTALL <serviceName> [options] <connect-string>\n"));
 	wxPrintf(fn->GetName() + _(" DEBUG [options] <connect-string>\n"));
 	wxPrintf(_("options:\n"));
+	wxPrintf(_("-v (display version info and then exit)\n"));
 	wxPrintf(_("-u <user or DOMAIN\\user>\n"));
 	wxPrintf(_("-p <password>\n"));
 	wxPrintf(_("-d <displayname>\n"));
