Portable mode moves debug.log
This commit is contained in:
parent
558dcf8550
commit
08694ecc38
|
@ -29,6 +29,8 @@ import os
|
||||||
from pyelliptic.openssl import OpenSSL
|
from pyelliptic.openssl import OpenSSL
|
||||||
import pickle
|
import pickle
|
||||||
import platform
|
import platform
|
||||||
|
import debug
|
||||||
|
from debug import logger
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
@ -1874,7 +1876,14 @@ class MyForm(QtGui.QMainWindow):
|
||||||
shared.knownNodesLock.release()
|
shared.knownNodesLock.release()
|
||||||
os.remove(shared.appdata + 'keys.dat')
|
os.remove(shared.appdata + 'keys.dat')
|
||||||
os.remove(shared.appdata + 'knownnodes.dat')
|
os.remove(shared.appdata + 'knownnodes.dat')
|
||||||
|
previousAppdataLocation = shared.appdata
|
||||||
shared.appdata = ''
|
shared.appdata = ''
|
||||||
|
debug.restartLoggingInUpdatedAppdataLocation()
|
||||||
|
try:
|
||||||
|
os.remove(previousAppdataLocation + 'debug.log')
|
||||||
|
os.remove(previousAppdataLocation + 'debug.log.1')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
if shared.appdata == '' and not self.settingsDialogInstance.ui.checkBoxPortableMode.isChecked(): # If we ARE using portable mode now but the user selected that we shouldn't...
|
if shared.appdata == '' and not self.settingsDialogInstance.ui.checkBoxPortableMode.isChecked(): # If we ARE using portable mode now but the user selected that we shouldn't...
|
||||||
shared.appdata = shared.lookupAppdataFolder()
|
shared.appdata = shared.lookupAppdataFolder()
|
||||||
|
@ -1894,6 +1903,12 @@ class MyForm(QtGui.QMainWindow):
|
||||||
shared.knownNodesLock.release()
|
shared.knownNodesLock.release()
|
||||||
os.remove('keys.dat')
|
os.remove('keys.dat')
|
||||||
os.remove('knownnodes.dat')
|
os.remove('knownnodes.dat')
|
||||||
|
debug.restartLoggingInUpdatedAppdataLocation()
|
||||||
|
try:
|
||||||
|
os.remove('debug.log')
|
||||||
|
os.remove('debug.log.1')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def click_radioButtonBlacklist(self):
|
def click_radioButtonBlacklist(self):
|
||||||
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'white':
|
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'white':
|
||||||
|
|
|
@ -5,6 +5,7 @@ import time
|
||||||
import shutil # used for moving the messages.dat file
|
import shutil # used for moving the messages.dat file
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
from debug import logger
|
||||||
|
|
||||||
# This thread exists because SQLITE3 is so un-threadsafe that we must
|
# This thread exists because SQLITE3 is so un-threadsafe that we must
|
||||||
# submit queries to it and it puts results back in a different queue. They
|
# submit queries to it and it puts results back in a different queue. They
|
||||||
|
|
15
src/debug.py
15
src/debug.py
|
@ -23,7 +23,8 @@ import shared
|
||||||
# TODO(xj9): Get from a config file.
|
# TODO(xj9): Get from a config file.
|
||||||
log_level = 'DEBUG'
|
log_level = 'DEBUG'
|
||||||
|
|
||||||
logging.config.dictConfig({
|
def configureLogging():
|
||||||
|
logging.config.dictConfig({
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'formatters': {
|
'formatters': {
|
||||||
'default': {
|
'default': {
|
||||||
|
@ -64,7 +65,17 @@ logging.config.dictConfig({
|
||||||
'level': log_level,
|
'level': log_level,
|
||||||
'handlers': ['console'],
|
'handlers': ['console'],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
# TODO (xj9): Get from a config file.
|
# TODO (xj9): Get from a config file.
|
||||||
#logger = logging.getLogger('console_only')
|
#logger = logging.getLogger('console_only')
|
||||||
|
configureLogging()
|
||||||
logger = logging.getLogger('both')
|
logger = logging.getLogger('both')
|
||||||
|
|
||||||
|
def restartLoggingInUpdatedAppdataLocation():
|
||||||
|
global logger
|
||||||
|
for i in list(logger.handlers):
|
||||||
|
logger.removeHandler(i)
|
||||||
|
i.flush()
|
||||||
|
i.close()
|
||||||
|
configureLogging()
|
||||||
|
logger = logging.getLogger('both')
|
Reference in New Issue
Block a user