import logging
import logging.config
import sys
import os

logFile = os.path.expanduser(os.path.join('~', '.flashget', 'verbose.log'))
logFileError = os.path.expanduser(os.path.join('~', '.flashget', 'error.log'))

logging.config.dictConfig({
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'standard': {
            'format': '%(asctime)s [%(levelname)5s] %(name)17s:%(lineno)03d: %(message)s'
        },
    },
    'handlers': {
        'default': {
            'level':'INFO',
            'class':'logging.StreamHandler',
            "formatter": "standard",
        },
        "debug_file_handler": {
            "class": "logging.handlers.RotatingFileHandler",
            "level": "DEBUG",
            "formatter": "standard",
            "filename": logFile,
            "maxBytes": 10485760,
            "backupCount": 20,
            "encoding": "utf8"
        },

        "error_file_handler": {
            "class": "logging.handlers.RotatingFileHandler",
            "level": "ERROR",
            "formatter": "standard",
            "filename": logFileError,
            "maxBytes": 10485760,
            "backupCount": 20,
            "encoding": "utf8"
        },
    },
    'loggers': {
        '': {
            'handlers': ['default', 'debug_file_handler', 'error_file_handler'],
            'level': 'DEBUG',
            'propagate': True,
        }
    }
})

_oldexcepthook = sys.excepthook
def handleException(excType, excValue, traceback):
    _oldexcepthook(excType, excValue, traceback)
    logging.getLogger().error("Uncaught exception", exc_info=(excType, excValue, traceback))
sys.excepthook = handleException

@@ -56,190 +56,25 @@
 os%0A%0A
-logFile = os.path.expanduser(os.path.join('~', '.flashget', 'verbose.log'))%0AlogFileError = os.path.expanduser(os.path.join('~', '.flashget', 'error.log'))%0A%0Alogging.config.dict
+%0Alogging
 Config
-(
+ = 
 %7B%0A  
@@ -442,20 +442,497 @@
  %7D,%0A    
+%7D,%0A
     
+'loggers': %7B%0A        '': %7B%0A            'handlers': %5B'default', 'debug_file_handler', 'error_file_handler'%5D,%0A            'level': 'DEBUG',%0A            'propagate': True,%0A        %7D%0A    %7D%0A%7D%0A%0Atry:%0A    os.mkdir(os.path.expanduser(os.path.join('~', '.flashget')))%0Aexcept:%0A    pass%0Aelse:%0A    logFile = os.path.expanduser(os.path.join('~', '.flashget', 'verbose.log'))%0A    logFileError = os.path.expanduser(os.path.join('~', '.flashget', 'error.log'))%0A    loggingConfig%5B'handlers'%5D%5B
 %22debug_f
@@ -935,33 +935,35 @@
 ug_file_handler%22
-:
+%5D =
  %7B%0A            %22
@@ -1219,19 +1219,39 @@
    %7D
-,%0A
 %0A    
-    
+loggingConfig%5B%22handlers%22%5D%5B
 %22err
@@ -1266,17 +1266,19 @@
 handler%22
-:
+%5D =
  %7B%0A     
@@ -1547,207 +1547,49 @@
    %7D
-,%0A    %7D,%0A    'loggers': %7B%0A        '': %7B%0A            'handlers': %5B'default', 'debug_file_handler', 'error_file_handler'%5D,%0A            'level': 'DEBUG',%0A            'propagate': True,%0A        %7D%0A    %7D%0A%7D
+%0A%0Alogging.config.dictConfig(loggingConfig
 )%0A%0A_

create .flashget dir before configuring the logfile name