[X2Go-Commits] [pyhoca-gui] 01/01: Windows PyHoca-GUI.log file: create with PID in file name. On log file creation try removing all old log files that are not still open.

git-admin at x2go.org git-admin at x2go.org
Tue Apr 15 22:29:02 CEST 2014


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository pyhoca-gui.

commit 086ceb89a4c24073d34e4dd010cdce03da1ee303
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue Apr 15 22:28:55 2014 +0200

    Windows PyHoca-GUI.log file: create with PID in file name. On log file creation try removing all old log files that are not still open.
---
 debian/changelog              |    2 ++
 pyhoca/wxgui/mswin_logging.py |   10 +++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 67836c4..65a6688 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -41,6 +41,8 @@ pyhoca-gui (0.5.0.0-0x2go1) UNRELEASED; urgency=low
     - Fix check_running() method in PyHocaGUI_Launcher on MS Windows.
     - Make broker support available for the MS Windows build of PyHoca-GUI.
     - Make check_running() test terminal server / multi-session safe. (Fixes: #19).
+    - Windows PyHoca-GUI.log file: create with PID in file name. On log file creation
+      try removing all old log files that are not still open.
     - Update English / German translation.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Wed, 08 Jan 2014 21:28:37 +0100
diff --git a/pyhoca/wxgui/mswin_logging.py b/pyhoca/wxgui/mswin_logging.py
index 6e680ba..ed02c9f 100644
--- a/pyhoca/wxgui/mswin_logging.py
+++ b/pyhoca/wxgui/mswin_logging.py
@@ -26,13 +26,17 @@ def setup_mswinlog(PROG_NAME):
         class MSWin_Logging(object):
 
             softspace = 0
-            _fname = os.path.join(os.environ['AppData'], PROG_NAME, '%s.log' % PROG_NAME)
+            _fname = os.path.normpath(os.path.join(os.environ['AppData'], PROG_NAME, '%s.%s.log' % (PROG_NAME, os.getpid())
             _file = None
 
             def __init__(self, filemode='a'):
                 self._filemode = filemode
-                if os.path.isfile(self._fname) and self._filemode == "w+":
-                    os.remove(self._fname)
+                if self._filemode == "w+":
+                    for _file in os.listdir(os.dirname(self._fname)):
+                        try:
+                            os.remove(_file)
+                        except WindowsError:
+                            pass
 
             def write(self, text, **kwargs):
                 if self._file is None:

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git



More information about the x2go-commits mailing list