Hello,

I'm new to Python/Ryu and I've a question regarding printing logs in Ryu (more
of Python, actually).

I followed some existing Ryu examples and Python documentation to create a
simple logging infra for my project. Code is given below.

Issue is that each of logs are printed twice. Once using my logger mechanism
(pretty print with all the formatting that I've enabled) and once more without
any formatting; just the bare message string.

I'm not sure where I went wrong. I searched about this a bit, but couldn't get
anywhere. Any help would be appreciated.

Thanks,
/Aravind


# Define a logger
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s | %(name)s | %(levelname)s |
%(message)s')
ch.setFormatter(formatter)
LOG.addHandler(ch)

# Use the logger
...
LOG.info('Installing drop IPv6 traffic on table %s', curr_table_id)
...

# This is what I see on the console
2014-11-24 15:25:07,080 | basic | INFO | Installing drop IPv6 traffic on table 0
Installing drop IPv6 traffic on table 0


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to