diff --git a/packaging/osx/lbry-osx-app/lbrygui/main.py b/packaging/osx/lbry-osx-app/lbrygui/main.py index d7ca4dc00..ce3e22631 100644 --- a/packaging/osx/lbry-osx-app/lbrygui/main.py +++ b/packaging/osx/lbry-osx-app/lbrygui/main.py @@ -4,32 +4,22 @@ install(runner=AppHelper.runEventLoop) from twisted.internet import reactor import logging -import sys -import os -from appdirs import user_data_dir +from lbrynet import conf +from lbrynet.core import log_support from LBRYApp import LBRYDaemonApp -if sys.platform != "darwin": - log_dir = os.path.join(os.path.expanduser("~"), ".lbrynet") -else: - log_dir = user_data_dir("LBRY") -if not os.path.isdir(log_dir): - os.mkdir(log_dir) - -LOG_FILENAME = os.path.join(log_dir, 'lbrynet-daemon.log') - -log = logging.getLogger(__name__) -handler = logging.handlers.RotatingFileHandler(LOG_FILENAME, maxBytes=2097152, backupCount=5) -log.addHandler(handler) -logging.basicConfig(level=logging.INFO) +log = logging.getLogger() def main(): + log_file = conf.get_log_filename() + log_support.configure_logging(log_file, console=False) app = LBRYDaemonApp.sharedApplication() reactor.addSystemEventTrigger("after", "shutdown", AppHelper.stopEventLoop) reactor.run() + if __name__ == "__main__": main() diff --git a/packaging/windows/lbry-win32-app/LBRYWin32App.py b/packaging/windows/lbry-win32-app/LBRYWin32App.py index 3810664d8..71b67b020 100644 --- a/packaging/windows/lbry-win32-app/LBRYWin32App.py +++ b/packaging/windows/lbry-win32-app/LBRYWin32App.py @@ -1,6 +1,5 @@ import logging import os -import socket import sys import threading import webbrowser @@ -11,13 +10,14 @@ import win32gui_struct from jsonrpc.proxy import JSONRPCProxy from twisted.internet import reactor, error from twisted.web import server -import twisted try: import winxpgui as win32gui except ImportError: import win32gui +from lbrynet import conf +from lbrynet.core import log_support from lbrynet.core import utils from lbrynet.lbrynet_daemon.DaemonServer import DaemonServer from lbrynet.lbrynet_daemon.DaemonRequest import DaemonRequest @@ -284,6 +284,8 @@ def main(lbry_name=None): if __name__ == '__main__': utils.setup_certs_for_windows() + log_file = conf.get_log_filename() + log_support.configure_logging(log_file, console=False) lbry_daemon = JSONRPCProxy.from_url(settings.API_CONNECTION_STRING) try: