commit
aced5b6499
5 changed files with 42 additions and 36 deletions
|
@ -12,15 +12,16 @@ at anytime.
|
||||||
* Add link to instructions on how to change the default peer port
|
* Add link to instructions on how to change the default peer port
|
||||||
* Add `peer_port` to settings configurable using `settings_set`
|
* Add `peer_port` to settings configurable using `settings_set`
|
||||||
* Added an option to disable max key fee check.
|
* Added an option to disable max key fee check.
|
||||||
*
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* Fix for https://github.com/lbryio/lbry/issues/750
|
* Fix for https://github.com/lbryio/lbry/issues/750
|
||||||
*
|
*
|
||||||
|
* Fixed daemon process hanging when started without an internet connection
|
||||||
|
* Fixed https://github.com/lbryio/lbry/issues/774
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
*
|
*
|
||||||
|
|
|
@ -145,7 +145,7 @@ FIXED_SETTINGS = {
|
||||||
},
|
},
|
||||||
'DB_REVISION_FILE_NAME': 'db_revision',
|
'DB_REVISION_FILE_NAME': 'db_revision',
|
||||||
'ICON_PATH': ICON_PATH,
|
'ICON_PATH': ICON_PATH,
|
||||||
'LOGGLY_TOKEN': 'LJEzATH4AzRgAwxjAP00LwZ2YGx3MwVgZTMuBQZ3MQuxLmOv',
|
'LOGGLY_TOKEN': 'BQEzZmMzLJHgAGxkBF00LGD0YGuyATVgAmqxAQEuAQZ2BQH4',
|
||||||
'LOG_FILE_NAME': 'lbrynet.log',
|
'LOG_FILE_NAME': 'lbrynet.log',
|
||||||
'LOG_POST_URL': 'https://lbry.io/log-upload',
|
'LOG_POST_URL': 'https://lbry.io/log-upload',
|
||||||
'MAX_BLOB_REQUEST_SIZE': 64 * KB,
|
'MAX_BLOB_REQUEST_SIZE': 64 * KB,
|
||||||
|
|
|
@ -7,6 +7,8 @@ import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from txrequests import Session
|
from txrequests import Session
|
||||||
|
from requests.exceptions import ConnectionError
|
||||||
|
from twisted.internet import defer
|
||||||
import twisted.python.log
|
import twisted.python.log
|
||||||
|
|
||||||
from lbrynet import __version__ as lbrynet_version, build_type, conf
|
from lbrynet import __version__ as lbrynet_version, build_type, conf
|
||||||
|
@ -32,11 +34,6 @@ _srcfile = os.path.normcase(_srcfile)
|
||||||
TRACE = 5
|
TRACE = 5
|
||||||
|
|
||||||
|
|
||||||
def bg_cb(sess, resp):
|
|
||||||
""" Don't do anything with the response """
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class HTTPSHandler(logging.Handler):
|
class HTTPSHandler(logging.Handler):
|
||||||
def __init__(self, url, fqdn=False, localname=None, facility=None, session=None):
|
def __init__(self, url, fqdn=False, localname=None, facility=None, session=None):
|
||||||
logging.Handler.__init__(self)
|
logging.Handler.__init__(self)
|
||||||
|
@ -52,14 +49,16 @@ class HTTPSHandler(logging.Handler):
|
||||||
else:
|
else:
|
||||||
return record.getMessage()
|
return record.getMessage()
|
||||||
|
|
||||||
def emit(self, record):
|
@defer.inlineCallbacks
|
||||||
|
def _emit(self, record):
|
||||||
|
payload = self.format(record)
|
||||||
try:
|
try:
|
||||||
payload = self.format(record)
|
yield self.session.post(self.url, data=payload)
|
||||||
self.session.post(self.url, data=payload, background_callback=bg_cb)
|
except ConnectionError:
|
||||||
except (KeyboardInterrupt, SystemExit):
|
pass
|
||||||
raise
|
|
||||||
except:
|
def emit(self, record):
|
||||||
self.handleError(record)
|
return self._emit(record)
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_FORMAT = "%(asctime)s %(levelname)-8s %(name)s:%(lineno)d: %(message)s"
|
DEFAULT_FORMAT = "%(asctime)s %(levelname)-8s %(name)s:%(lineno)d: %(message)s"
|
||||||
|
@ -109,11 +108,11 @@ def configure_handler(handler, log, level):
|
||||||
|
|
||||||
|
|
||||||
def disable_third_party_loggers():
|
def disable_third_party_loggers():
|
||||||
logging.getLogger('requests').setLevel(logging.WARNING)
|
logging.getLogger('requests').setLevel(logging.CRITICAL)
|
||||||
logging.getLogger('urllib3').setLevel(logging.WARNING)
|
logging.getLogger('urllib3').setLevel(logging.CRITICAL)
|
||||||
logging.getLogger('BitcoinRPC').setLevel(logging.INFO)
|
logging.getLogger('BitcoinRPC').setLevel(logging.INFO)
|
||||||
logging.getLogger('lbryum').setLevel(logging.WARNING)
|
logging.getLogger('lbryum').setLevel(logging.WARNING)
|
||||||
logging.getLogger('twisted').setLevel(logging.WARNING)
|
logging.getLogger('twisted').setLevel(logging.CRITICAL)
|
||||||
|
|
||||||
|
|
||||||
@_log_decorator
|
@_log_decorator
|
||||||
|
@ -140,18 +139,27 @@ def get_loggly_url(token=None, version=None):
|
||||||
return LOGGLY_URL.format(token=token, tag='lbrynet-' + version)
|
return LOGGLY_URL.format(token=token, tag='lbrynet-' + version)
|
||||||
|
|
||||||
|
|
||||||
def configure_loggly_handler(*args, **kwargs):
|
def configure_loggly_handler():
|
||||||
if build_type.BUILD == 'dev':
|
if build_type.BUILD == 'dev':
|
||||||
return
|
return
|
||||||
level = kwargs.pop('level', logging.WARNING)
|
level = logging.WARNING
|
||||||
_configure_loggly_handler(*args, level=level, **kwargs)
|
handler = get_loggly_handler(level=level, installation_id=conf.settings.installation_id,
|
||||||
|
session_id=conf.settings.get_session_id())
|
||||||
|
log = logging.getLogger("lbrynet")
|
||||||
|
if handler.name:
|
||||||
|
remove_handlers(log, handler.name)
|
||||||
|
handler.setLevel(level)
|
||||||
|
log.addHandler(handler)
|
||||||
|
# need to reduce the logger's level down to the
|
||||||
|
# handler's level or else the handler won't
|
||||||
|
# get those messages
|
||||||
|
if log.level > level:
|
||||||
|
log.setLevel(level)
|
||||||
|
|
||||||
|
|
||||||
@_log_decorator
|
def get_loggly_handler(level, installation_id, session_id):
|
||||||
def _configure_loggly_handler(url=None, **kwargs):
|
formatter = JsonFormatter(level=level, installation_id=installation_id, session_id=session_id)
|
||||||
url = url or get_loggly_url()
|
handler = HTTPSHandler(get_loggly_url())
|
||||||
formatter = JsonFormatter(**kwargs)
|
|
||||||
handler = HTTPSHandler(url)
|
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
handler.name = 'loggly'
|
handler.name = 'loggly'
|
||||||
return handler
|
return handler
|
||||||
|
@ -256,7 +264,6 @@ def configure_logging(file_name, console, verbose=None):
|
||||||
verbose = convert_verbose(verbose)
|
verbose = convert_verbose(verbose)
|
||||||
configure_twisted()
|
configure_twisted()
|
||||||
configure_file_handler(file_name)
|
configure_file_handler(file_name)
|
||||||
configure_loggly_handler()
|
|
||||||
disable_third_party_loggers()
|
disable_third_party_loggers()
|
||||||
if console:
|
if console:
|
||||||
# if there are some loggers at the debug level, we need
|
# if there are some loggers at the debug level, we need
|
||||||
|
|
|
@ -24,7 +24,7 @@ from lbrynet import conf, analytics
|
||||||
from lbrynet.conf import LBRYCRD_WALLET, LBRYUM_WALLET, PTC_WALLET
|
from lbrynet.conf import LBRYCRD_WALLET, LBRYUM_WALLET, PTC_WALLET
|
||||||
from lbrynet.reflector import reupload
|
from lbrynet.reflector import reupload
|
||||||
from lbrynet.reflector import ServerFactory as reflector_server_factory
|
from lbrynet.reflector import ServerFactory as reflector_server_factory
|
||||||
|
from lbrynet.core.log_support import configure_loggly_handler
|
||||||
from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileSaverFactory
|
from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileSaverFactory
|
||||||
from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileOpenerFactory
|
from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileOpenerFactory
|
||||||
from lbrynet.lbry_file.client.EncryptedFileOptions import add_lbry_file_to_sd_identifier
|
from lbrynet.lbry_file.client.EncryptedFileOptions import add_lbry_file_to_sd_identifier
|
||||||
|
@ -36,7 +36,7 @@ from lbrynet.daemon.Publisher import Publisher
|
||||||
from lbrynet.daemon.ExchangeRateManager import ExchangeRateManager
|
from lbrynet.daemon.ExchangeRateManager import ExchangeRateManager
|
||||||
from lbrynet.daemon.auth.server import AuthJSONRPCServer
|
from lbrynet.daemon.auth.server import AuthJSONRPCServer
|
||||||
from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager
|
from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager
|
||||||
from lbrynet.core import log_support, utils, system_info
|
from lbrynet.core import utils, system_info
|
||||||
from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier, download_sd_blob
|
from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier, download_sd_blob
|
||||||
from lbrynet.core.Session import Session
|
from lbrynet.core.Session import Session
|
||||||
from lbrynet.core.Wallet import LBRYumWallet, SqliteStorage, ClaimOutpoint
|
from lbrynet.core.Wallet import LBRYumWallet, SqliteStorage, ClaimOutpoint
|
||||||
|
@ -225,7 +225,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
def setup(self):
|
def setup(self):
|
||||||
reactor.addSystemEventTrigger('before', 'shutdown', self._shutdown)
|
reactor.addSystemEventTrigger('before', 'shutdown', self._shutdown)
|
||||||
|
|
||||||
self._modify_loggly_formatter()
|
configure_loggly_handler()
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _announce_startup():
|
def _announce_startup():
|
||||||
|
@ -505,12 +505,6 @@ class Daemon(AuthJSONRPCServer):
|
||||||
return d
|
return d
|
||||||
return defer.succeed(True)
|
return defer.succeed(True)
|
||||||
|
|
||||||
def _modify_loggly_formatter(self):
|
|
||||||
log_support.configure_loggly_handler(
|
|
||||||
installation_id=conf.settings.installation_id,
|
|
||||||
session_id=self._session_id
|
|
||||||
)
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _setup_lbry_file_manager(self):
|
def _setup_lbry_file_manager(self):
|
||||||
log.info('Starting to setup up file manager')
|
log.info('Starting to setup up file manager')
|
||||||
|
|
|
@ -367,7 +367,11 @@ class KademliaProtocol(protocol.DatagramProtocol):
|
||||||
# i'm scared this may swallow important errors, but i get a million of these
|
# i'm scared this may swallow important errors, but i get a million of these
|
||||||
# on Linux and it doesnt seem to affect anything -grin
|
# on Linux and it doesnt seem to affect anything -grin
|
||||||
log.debug("Can't send data to dht: EWOULDBLOCK")
|
log.debug("Can't send data to dht: EWOULDBLOCK")
|
||||||
|
elif err.errno == errno.ENETUNREACH:
|
||||||
|
# this should probably try to retransmit when the network connection is back
|
||||||
|
log.error("Network is unreachable")
|
||||||
else:
|
else:
|
||||||
|
log.error("DHT socket error: %s (%i)", err.message, err.errno)
|
||||||
raise err
|
raise err
|
||||||
|
|
||||||
def _sendResponse(self, contact, rpcID, response):
|
def _sendResponse(self, contact, rpcID, response):
|
||||||
|
|
Loading…
Add table
Reference in a new issue