Commit 8f162e28 authored by Federico Sismondi's avatar Federico Sismondi

fixes for better logging

parent 387063d7
Pipeline #1827 passed with stage
in 0 seconds
......@@ -37,4 +37,5 @@ if __name__ == '__main__':
#from examples_pcap_base64 import PCAP_COAP_TC4_OVER_TUN_INTERFACE_base64,PCAP_ONEM2M_TD_M2M_NH_06
#base_64_pcap_value = "1MOyoQIABAAAAAAAAAAAAMgAAABlAAAAuDomWkVbCQCLAAAAiwAAAGABrlcAYxFAu7sAAAAAAAAAAAAAAAAAAbu7AAAAAAAAAAAAAAAAAAKOoRYzAGM/fEQC7BP7dUmTsX4Gc2VydmVyBnNlcnZlchEyUTLR4kMWMTAwNDg2oQL/eyJtMm06YWUiOnsicnIiOmZhbHNlLCJhcGkiOjEyMzQ1LCJybiI6ImFlVGVzdEMifX24OiZavKEKAMgAAAAyAgAAYAjkQQIKEUC7uwAAAAAAAAAAAAAAAAACu7sAAAAAAAAAAAAAAAAAARYzjqECCqBwZEHsE/t1SZONES9zZXJ2ZXIvQ0FFMTMxMjU0MDI5MDMwNzk4NjM0M0Ey1ugxMDA0ODaCB9H/ewogICAibTJtOmFlIiA6IHsKICAgICAgInJuIiA6ICJhZVRlc3RDIiwKICAgICAgInR5IiA6IDIsCiAgICAgICJyaSIgOiAiL3NlcnZlci9DQUUxMzEyNTQwMjkwMzA3OTg="
base_64_pcap_value = "1MOyoQIABAAAAAAAAAAAAMgAAABlAAAAk9MmWiSMDgCLAAAAiwAAAGABhdIAYxFAu7sAAAAAAAAAAAAAAAAAAru7AAAAAAAAAAAAAAAAAAGeoBYzAGMRfUQCGw2HLKvhsX4Gc2VydmVyBnNlcnZlchEyUTLR4kMWMTAwMzk5oQL/eyJtMm06YWUiOnsicnIiOmZhbHNlLCJhcGkiOjEyMzQ1LCJybiI6ImFlVGVzdEMifX2U0yZaDxsAAMgAAAAzAgAAYAQl6AILEUC7uwAAAAAAAAAAAAAAAAABu7sAAAAAAAAAAAAAAAAAAhYznqACC63hZEEbDYcsq+GNES9zZXJ2ZXIvQ0FFMzEzNTI5MDgyMzA2NDI1ODY2OEEy1ugxMDAzOTmCB9H/ewogICAibTJtOmFlIiA6IHsKICAgICAgInJuIiA6ICJhZVRlc3RDIiwKICAgICAgInR5IiA6IDIsCiAgICAgICJyaSIgOiAiL3NlcnZlci9DQUUzMTM1MjkwODIzMDY0MjU="
save_pcap_from_base64('test2.pcap', base_64_pcap_value)
b="1MOyoQIABAAAAAAAAAAAANAHAABlAAAAUH5eWpoNAABcAAAAXAAAAGAAH+YANBFAu7sAAAAAAAAAAAAAAAAAAru7AAAAAAAAAAAAAAAAAAEWM6EmADQyqGBFAUTAIR7/VHlwZTogMCAoQ09OKQpDb2RlOiAxIChHRVQpCk1JRDogMzI0"
save_pcap_from_base64('test2.pcap', b)
......@@ -12,6 +12,7 @@ except:
VERSION = '0.0.9'
AMQP_EXCHANGE = 'amq.topic'
MAX_LOG_LINE_LENGTH = 120
class AmqpSynchCallTimeoutError(Exception):
......@@ -109,7 +110,7 @@ class AmqpListener(threading.Thread):
if m is None:
raise Exception("Couldnt build message from json %s, rkey: %s " % (body, method.routing_key))
m.routing_key = method.routing_key
logging.debug('Message in bus: %s' % repr(m))
logging.debug('Message in bus: %s' % repr(m)[:MAX_LOG_LINE_LENGTH])
self.message_dispatcher(m)
except NonCompliantMessageFormatError as e:
......@@ -158,7 +159,7 @@ class AmqpListener(threading.Thread):
logging.error(traceback.format_exc())
self.amqp_connect()
logging.info('Bye byes!')
logging.info('%s says Bye byes!' % self.COMPONENT_ID)
def publish_message(connection, message):
......
......@@ -85,7 +85,7 @@ class AmqpDataPacketDumper:
DEFAULT_LOG_LEVEL = 10 # 10-> debug
DEFAULT_FILENAME = "DLT_RAW.pcap"
QUANTITY_MESSAGES_PER_PCAP = 100
QUANTITY_MESSAGES_PER_PCAP = 1000
def dumper_init(self):
# delete tmp pcap file (the one with ~)
......@@ -104,7 +104,7 @@ class AmqpDataPacketDumper:
network=self.dlt
)
# copy filename.pcap~ to filename.pcap
# copy filename.pcap~ to filename.pcap, so we have a pcap file in the dir since the bagging, even if it's empty
shutil.copyfile(
os.path.join(self.dump_dir, self.pcap_filename_wr),
os.path.join(self.dump_dir, self.pcap_filename)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment