# \[RFC\] Generic Logger names in Python

**URL:** <https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611>\
**Category:** RFC\
**Created:** [April 20, 2022, 10:52am UTC](https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611 "2022-04-20T10:52:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![pfk123](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/pfk123/32/3209_2.png) [@pfk123](https://discuss.tvm.apache.org/u/pfk123)\
**Post date:** [April 20, 2022, 10:52am UTC](https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611/1 "2022-04-20T10:52:14Z")

</div>

Hello,

my first RFC, in life, so be patient. When I run command `find python -type f -name "*.py" | xargs grep getLogger` I can see, that names of Loggers are manually provided, e.g. `Ethos-U`, `RPCTracker` or `auto_scheduler`. As I can read in python logging tutorial better name is ` __name__ ` variable. It doesn’t require maintain names and is more generic to use filters, then example logger names would be `tvm.relay.backend.contrib.ethosu.vela_api`, `tvm.rpc.tracker` and `tvm.auto_scheduler.search_task` respectively.

I think it is easy to implement, and doesn’t introduce functionality changes. Places to check when configure logging, because many names will change.

---

<div class="post-metadata">

**Author:** ![junrushao](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/junrushao/32/205_2.png) [@junrushao](https://discuss.tvm.apache.org/u/junrushao)\
**Post date:** [April 20, 2022, 3:10pm UTC](https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611/2 "2022-04-20T15:10:54Z")

</div>

Thanks @pfk123! Personally I don’t know the specific reason that we didn’t do

```python
logger = getLogger( __name__ )

```

previously in the TVM codebase, and would love to hear from fellow developers. If there is no specific reason, I’m supportive for making this change

---

<div class="post-metadata">

**Author:** ![areusch](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/areusch/32/2118_2.png) [@areusch](https://discuss.tvm.apache.org/u/areusch)\
**Post date:** [April 20, 2022, 4:06pm UTC](https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611/3 "2022-04-20T16:06:01Z")

</div>

I support `getLogger( __name__ )`!

---

<div class="post-metadata">

**Author:** ![pfk123](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/pfk123/32/3209_2.png) [@pfk123](https://discuss.tvm.apache.org/u/pfk123)\
**Post date:** [April 21, 2022, 10:20am UTC](https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611/4 "2022-04-21T10:20:10Z")

</div>

> <https://github.com/apache/tvm/pull/11089>
>
> This is PR related to RFC posted here: https://discuss.tvm.apache.org/t/pre-rfc-…generic-logger-names-in-python/12611 . I've changed hardcoded logger names to generic \`\_\_name\_\_\`. I've changed most of the examples, but few I didn't touch - let's discuss them, because I'm not sure wether change it. 
> 
> Points to discuss:
> 1. \`./autotvm/graph\_tuner/base\_graph\_tuner.py: self.\_logger = logging.getLogger(name + "\_logger")\`
> 2. \`./meta\_schedule/testing/tune\_te\_meta\_schedule.py:logging.getLogger("tvm.meta\_schedule").setLevel(logging.DEBUG)\`
> 3. \`./meta\_schedule/testing/tune\_relay\_meta\_schedule.py:logging.getLogger("tvm.meta\_schedule").setLevel(logging.DEBUG)\`
> 4. \`./driver/tvmc/main.py: logging.getLogger("tvm.driver.tvmc").setLevel(40 - args.verbose \* 10)\`
> 
> I hope I didn't break your workflows:)

---

<div class="post-metadata">

**Author:** ![junrushao](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/junrushao/32/205_2.png) [@junrushao](https://discuss.tvm.apache.org/u/junrushao)\
**Post date:** [April 21, 2022, 5:27pm UTC](https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611/5 "2022-04-21T17:27:04Z")

</div>

Thanks @pfk123 for the PR!

@areusch Do you think we should send a formal RFC to [TVM-RFC](https://github.com/apache/tvm-rfcs) repo? I suppose so, but was wondering what we could do to accelerate this process for short and non-controversial ones like this

---

<div class="post-metadata">

**Author:** ![tqchen](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/tqchen/32/5_2.png) [@tqchen](https://discuss.tvm.apache.org/u/tqchen)\
**Post date:** [April 21, 2022, 5:45pm UTC](https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611/6 "2022-04-21T17:45:26Z")

</div>

In this particular case I think it might be fine to skip given it is short and non-controversial, but good to leave it open for a bit

---

<div class="post-metadata">

**Author:** ![areusch](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/areusch/32/2118_2.png) [@areusch](https://discuss.tvm.apache.org/u/areusch)\
**Post date:** [April 21, 2022, 5:51pm UTC](https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611/7 "2022-04-21T17:51:57Z")

</div>

Yeah this one seems perhaps not worthy of a full RFC–it’s just a bunch of renames, and there isn’t a departure from policy. I was considering approving the PR immediately this morning but I think it would be good to allow another day or two in case someone has a legitimate concern.

i wish we had a comprehensive TVM logging guide, then we could just update that as a form of announcement of this cleanup (I think this thread otherwise is fine as a notification).

---

<div class="post-metadata">

**Author:** ![junrushao](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/junrushao/32/205_2.png) [@junrushao](https://discuss.tvm.apache.org/u/junrushao)\
**Post date:** [April 21, 2022, 7:27pm UTC](https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611/8 "2022-04-21T19:27:39Z")

</div>

> [@areusch](#):
>
> I think it would be good to allow another day or two in case someone has a legitimate concern

Yeah I agree. Sorry I rushed a bit quicker, but let’s leave it open for a week or two in case there is any concern 🙂

> [@areusch](#):
>
> i wish we had a comprehensive TVM logging guide, then we could just update that as a form of announcement of this cleanup (I think this thread otherwise is fine as a notification).

100% agree! The current logging system is a bit unsatisfactory in terms of clarity ☹

> [@areusch](#):
>
> Yeah this one seems perhaps not worthy of a full RFC

Just for record keeping, can we do a really short one, like 1 sentence or 2?

---

<div class="post-metadata">

**Author:** ![areusch](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/areusch/32/2118_2.png) [@areusch](https://discuss.tvm.apache.org/u/areusch)\
**Post date:** [April 21, 2022, 7:58pm UTC](https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611/9 "2022-04-21T19:58:38Z")

</div>

> [@junrushao](#):
>
> > [@areusch](#):
> >
> > Yeah this one seems perhaps not worthy of a full RFC
> 
> Just for record keeping, can we do a really short one, like 1 sentence or 2?

I’d almost prefer to put any such effort into just documenting logging, even if it’s just the Python part first. This isn’t anything elaborate–it’s just “use the standard Python logging as it normally is, with ` __name__ ` as the Logger name.”

---

<div class="post-metadata">

**Author:** ![junrushao](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/junrushao/32/205_2.png) [@junrushao](https://discuss.tvm.apache.org/u/junrushao)\
**Post date:** [April 21, 2022, 8:15pm UTC](https://discuss.tvm.apache.org/t/rfc-generic-logger-names-in-python/12611/10 "2022-04-21T20:15:30Z")

</div>

> [@areusch](#):
>
> I’d almost prefer to put any such effort into just documenting logging, even if it’s just the Python part first. This isn’t anything elaborate–it’s just “use the standard Python logging as it normally is, with ` __name__ ` as the Logger name.”

Haha that makes sense to me.
