<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks! That worked!!!!<div><br></div><div><br></div><div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>PCM (Paul Michali)</div><div><br></div><div>MAIL          <a href="mailto:pcm@cisco.com">pcm@cisco.com</a></div><div>IRC            pcm_  (<a href="http://irc.freenode.net">irc.freenode.net</a>)</div><div>TW            @pmichali</div><div>GPG key    4525ECC253E31A83</div><div>Fingerprint 307A 96BB 1A4C D2C7 931D 8D2D 4525 ECC2 53E3 1A83</div></div></span>
</div>

<br><div><div>On Dec 9, 2013, at 5:27 PM, Vishvananda Ishaya <<a href="mailto:vishvananda@gmail.com">vishvananda@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 6, 2013, at 2:09 PM, Paul Michali <<a href="mailto:pcm@cisco.com">pcm@cisco.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>For Neutron, I'm creating a module (one of several eventually) as part of a new blueprint I'm working on, and the associated unit test module. I'm in really early development, and just running this UT module as a standalone script (rather than through tox). It allows me to do TDD pretty quickly on the code I'm developing (that's the approach I'm taking right now - fingers crossed :).</div><div><br></div><div>In the module, I did an import of the <b>logging</b> package and when I run UTs I can see messaging that would occur, if desired.</div><div><br></div><div>I have the following hack to turn off/on the logging for debug level:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(203, 203, 203); "><span style="color: #0433ff">if</span><span style=""> </span><span style="color: #0433ff">False</span><span style="">:  </span># Debugging</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(0, 180, 0); "><span style="">    logging.basicConfig(format=</span>'%(asctime)-15s [%(levelname)s] %(message)s'<span style="">,</span></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">                        level=logging.DEBUG)</div></div><div><br></div><div>I made the log calls the same as what would be in other Neutron code, so that I don't have to change the code later, as I start to fold it into the Neutron code. However, I'd like to import the <b>neutron.openstack.common.log</b> package in my code, so that the code will be identical to what is needed once I start running this code as part of a process, but I had some questions…</div><div><br></div><div>When using neutron.openstack.common.log, how do I toggle the debug level logging on, if I run this standalone, as I'm doing now?</div><div>Is there a way to do it, without adding in the above conditional logic to the production code? Maybe put something in the UT module?</div></div></blockquote><div><br></div><div>I believe you can just make sure to set_override on the CONF option to True and then call logging.setup('neutron')</div><div><br></div><div>Here is an example with the nova code</div><div><br></div><div>>>> from nova.openstack.common import log as logging</div><div>>>> LOG = logging.getLogger(__name__)</div><div>>>> LOG.debug('foo')</div><div>>>> logging.CONF.set_override('debug', True)</div><div>>>> logging.setup('nova')</div><div>>>> LOG.debug('foo')</div><div>2013-12-09 14:25:21.220 72011 DEBUG __main__ [-] foo <module> <input>:2</div><div><br></div><div>Vish</div><div><br></div><div><br></div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>I can always continue as is, and then switch things over later (changing the import line and pulling the if clause), once I have things mostly done, and want to run as part of Neutron, but it would be nice if I can find a way to do that up front to avoid changes later.</div><div><br></div><div>Thoughts? Suggestions?</div><div><br></div><div>Thanks!</div><div><br></div><div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>PCM (Paul Michali)</div><div><br></div><div>MAIL          <a href="mailto:pcm@cisco.com">pcm@cisco.com</a></div><div>IRC            pcm_  (<a href="http://irc.freenode.net/">irc.freenode.net</a>)</div><div>TW            @pmichali</div><div>GPG key    4525ECC253E31A83</div><div>Fingerprint 307A 96BB 1A4C D2C7 931D 8D2D 4525 ECC2 53E3 1A83</div></div></span>
</div>

<br></div></div>_______________________________________________<br>OpenStack-dev mailing list<br><a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br><a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br></blockquote></div><br></div>_______________________________________________<br>OpenStack-dev mailing list<br><a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev<br></blockquote></div><br></div></body></html>