Discussing improvements of django.setup()

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Discussing improvements of django.setup()

Pakal
Hello everyone,

I'm bringing here, for broader review and discussion, the subject of making django setup more "tweakable":
https://code.djangoproject.com/ticket/30536
https://github.com/django/django/pull/11435

There is indeed a need for doing pre/post operations at that crucial moment of the framework lifetime, especially to apply compatibility shims (greening-related, API stability-related...) and setup test scaffolding, stubs etc.

A separate PR has been created to handle threadsafety/idempotence (https://github.com/django/django/pull/11440) when multiple actors try to setup django concurrently, but a discussion remains on how to potentially allow users to specify an alternative setup

I originally did a POC with a new django setting, but if we want to have full control, even settings might not be normally loaded at that stage. So maybe, as apollo13 suggested, an environment variable, like DJANGO_SETUP_CALLABLE, complementing the DJANGO_SETTINGS_MODULE one?
What are your thoughts about this ?

thanks,
regards,
Pakal

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/0206c98c-199f-49f9-9ff7-cba736e71224%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Discussing improvements of django.setup()

Aymeric Augustin
Hello Pakal,

Making django.setup() idempotent


> I've been bitten numerous times by the impredictable behaviour of django when django.setup() was called numerous times.
> In the old days I had exceptions, now it's mainly subtle breakages of logging configuration.

This is fuzzy for a bug report. Ideally, you should say:

- What you're doing (minimal reproduction instructions, within supported use of Django)
- What results you're expecting
- What results you're getting

Anyway it suggests that the problem is about logging. In this comment I said that the only possible bug is that `configure_logging()` isn't idempotent. Your answer confirms that the issue is really about logging. Let's fix configure_logging(), then!

Barring new arguments in favor of the proposed approach, which involves nested locks, I'm -1. Nested locks create a possibility of deadlocks. See my comment on the PR for details.

Making django.setup() tweakable

Again, the rationale is fuzzy. I'm seeing two use cases:

- pytest-django
- django-compat-patchers

One more or one less monkey patch isn't going to make a difference to these projects ;-)

I'm ready to accept that there's a need for projects that aren't big hacks but I need to see it explained clearly and specifically. I'd really like to see a feature request in the form of:

- I want to do X, which is a reasonable thing to do and stays within supported use of Django, except I need to override django.setup()
- Here's what the code looks like with a workaround (monkey-patching, probably)
- Here's what the code would look like with the improvement I'm asking for (hopefully much better)
- Here are the alternatives I considered and why I rejected them
- Other use cases also include Y and Z

I'm asking this because concrete use cases will put us in a better position to find the best solution.

Best regards,

-- 
Aymeric.



On 27 Jun 2019, at 23:26, Pkl <[hidden email]> wrote:

Hello everyone,

I'm bringing here, for broader review and discussion, the subject of making django setup more "tweakable":

There is indeed a need for doing pre/post operations at that crucial moment of the framework lifetime, especially to apply compatibility shims (greening-related, API stability-related...) and setup test scaffolding, stubs etc.

A separate PR has been created to handle threadsafety/idempotence (https://github.com/django/django/pull/11440) when multiple actors try to setup django concurrently, but a discussion remains on how to potentially allow users to specify an alternative setup

I originally did a POC with a new django setting, but if we want to have full control, even settings might not be normally loaded at that stage. So maybe, as apollo13 suggested, an environment variable, like DJANGO_SETUP_CALLABLE, complementing the DJANGO_SETTINGS_MODULE one?
What are your thoughts about this ?

thanks,
regards,
Pakal


--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/0206c98c-199f-49f9-9ff7-cba736e71224%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/4673AD3D-4EDF-44FB-931F-B3E231D6311D%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Discussing improvements of django.setup()

Pakal
Hello Aymeric,

regarding django.setup() idempotence I continued discussion in the PR.

Regarding django.setup() tweakability, the generic need is simply to have a hook, somewhere for users to put early init code, regardless of the way django is launched. Code that needs to execute this early are mostly (if not all) monkey-patching the environnement, a little like a LD_PRELOAD logic python-style.

This can be:
- for (of course) the init of django-compat-patcher
- greening of the environment (e.g. as https://github.com/erickponce/django-db-geventpool recommends, for Gevent or Eventlet)
- early tweaking of some process aspects likes socket timeouts (they broke for me when used along with mutiprocessing, but several years ago)
- possibly setup of specific test scaffolding, for which late mock()-style things aren't enough (I have no precise scenario in mind for this one, even though I know we did suffer with a Jpype bridge to a java LDAP client, which required tons of care to not break, including being initialized rather early along with process signal handlers)

Without a hook built into django, users that need such early setup have to duplicate their efforts for each way Django can be launched, and they must call their patching code in manage.py, in the wsgi file, in their custom scripts, and in their specific runners likes pytest-django (this last case is quite uneasy to handle at the moment, due to its very early setup of Django).

I'm afraid I can't provide much code to help the pondering; simply, without builtin hook, the user has to battle to ensure the kind of lines like the following are always executed before django.setup(). If Django provides a hook, it's so much less to worry about.

from psycogreen.gevent import patch_psycopg
patch_psycopg()

There are surely lots of ways to provide such a hook, via new settings, or new environment variables, or modules following precise naming conventions that django would systematically try to import... I have no idea how exactly my approach is rated amongst them.

As for alternatives to these early setup hooks, I'm alas clueless...

regards,
Pakal









On Sunday, June 30, 2019 at 10:25:15 AM UTC+2, Aymeric Augustin wrote:
Hello Pakal,

Making django.setup() idempotent

In <a href="https://code.djangoproject.com/ticket/28752" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F28752\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD_puFaHUsowObt1qLUcfkEdrWOA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F28752\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD_puFaHUsowObt1qLUcfkEdrWOA&#39;;return true;">https://code.djangoproject.com/ticket/28752, you say:

> I've been bitten numerous times by the impredictable behaviour of django when django.setup() was called numerous times.
> In the old days I had exceptions, now it's mainly subtle breakages of logging configuration.

This is fuzzy for a bug report. Ideally, you should say:

- What you're doing (minimal reproduction instructions, within supported use of Django)
- What results you're expecting
- What results you're getting

Anyway it suggests that the problem is about logging. In <a href="https://github.com/django/django/pull/11440#pullrequestreview-250231882" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F11440%23pullrequestreview-250231882\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHphf8IN7KC2VkvlGPB5JuwcbYIHA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F11440%23pullrequestreview-250231882\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHphf8IN7KC2VkvlGPB5JuwcbYIHA&#39;;return true;">this comment I said that the only possible bug is that `configure_logging()` isn't idempotent. <a href="https://github.com/django/django/pull/11440#issuecomment-504116261" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F11440%23issuecomment-504116261\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFwplPnhpuVt62rQS2CmuTFRhKLag&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F11440%23issuecomment-504116261\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFwplPnhpuVt62rQS2CmuTFRhKLag&#39;;return true;">Your answer confirms that the issue is really about logging. Let's fix configure_logging(), then!

Barring new arguments in favor of the proposed approach, which involves nested locks, I'm -1. Nested locks create a possibility of deadlocks. See my comment on the PR for details.

Making django.setup() tweakable

Again, the rationale is fuzzy. I'm seeing two use cases:

- pytest-django
- django-compat-patchers

One more or one less monkey patch isn't going to make a difference to these projects ;-)

I'm ready to accept that there's a need for projects that aren't big hacks but I need to see it explained clearly and specifically. I'd really like to see a feature request in the form of:

- I want to do X, which is a reasonable thing to do and stays within supported use of Django, except I need to override django.setup()
- Here's what the code looks like with a workaround (monkey-patching, probably)
- Here's what the code would look like with the improvement I'm asking for (hopefully much better)
- Here are the alternatives I considered and why I rejected them
- Other use cases also include Y and Z

I'm asking this because concrete use cases will put us in a better position to find the best solution.

Best regards,

-- 
Aymeric.



On 27 Jun 2019, at 23:26, Pkl <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="f4Im9wfiCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">chambo...@...> wrote:

Hello everyone,

I'm bringing here, for broader review and discussion, the subject of making django setup more "tweakable":
<a href="https://code.djangoproject.com/ticket/30536" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F30536\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHMLhmP53GssHQNe7_tUrX3YtbTA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F30536\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHMLhmP53GssHQNe7_tUrX3YtbTA&#39;;return true;">https://code.djangoproject.com/ticket/30536
<a href="https://github.com/django/django/pull/11435" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F11435\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEAJ735ZUD9a3VI5hY6Qn0v3fMiBg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F11435\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEAJ735ZUD9a3VI5hY6Qn0v3fMiBg&#39;;return true;">https://github.com/django/django/pull/11435

There is indeed a need for doing pre/post operations at that crucial moment of the framework lifetime, especially to apply compatibility shims (greening-related, API stability-related...) and setup test scaffolding, stubs etc.

A separate PR has been created to handle threadsafety/idempotence (<a href="https://github.com/django/django/pull/11440" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F11440\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHIwPWFwxBta7zSbFwPMohPazj7Qw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F11440\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHIwPWFwxBta7zSbFwPMohPazj7Qw&#39;;return true;">https://github.com/django/django/pull/11440) when multiple actors try to setup django concurrently, but a discussion remains on how to potentially allow users to specify an alternative setup

I originally did a POC with a new django setting, but if we want to have full control, even settings might not be normally loaded at that stage. So maybe, as apollo13 suggested, an environment variable, like DJANGO_SETUP_CALLABLE, complementing the DJANGO_SETTINGS_MODULE one?
What are your thoughts about this ?

thanks,
regards,
Pakal


--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="f4Im9wfiCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-d...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="f4Im9wfiCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-d...@googlegroups.com.
Visit this group at <a href="https://groups.google.com/group/django-developers" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-developers&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-developers&#39;;return true;">https://groups.google.com/group/django-developers.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-developers/0206c98c-199f-49f9-9ff7-cba736e71224%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-developers/0206c98c-199f-49f9-9ff7-cba736e71224%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-developers/0206c98c-199f-49f9-9ff7-cba736e71224%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-developers/0206c98c-199f-49f9-9ff7-cba736e71224%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a1db198b-27ba-4988-a9ad-67a2cf23e32e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Discussing improvements of django.setup()

Christian González

Am 01.07.19 um 23:24 schrieb Pkl:

>
> Regarding django.setup() tweakability, the generic need is simply to
> have a hook, somewhere for users to put early init code, regardless of
> the way django is launched. Code that needs to execute this early are
> mostly (if not all) monkey-patching the environnement, a little like a
> LD_PRELOAD logic python-style.
> [snip]
> There are surely lots of ways to provide such a hook, via new
> settings, or new environment variables, or modules following precise
> naming conventions that django would systematically try to import... I
> have no idea how exactly my approach is rated amongst them.
>
> As for alternatives to these early setup hooks, I'm alas clueless...
Why not a setup() method in the Apps' AppConfig, like ready()? This way
the AppConfig would be used more. Problem here is: when setup runs, it
is loading the settings. And THERE INSTALLED_APPS first time tell Django
which apps are installed. So before that point, it's not possible to 
"import modules from apps following a precise naming convention" etc. Or
did you mean "modules" outside of apps like e.g. a
"django_hook_setup_foo" python module? (Grrrrrr.)

Maybe here could again help to extract the apps list out of settings,
and use a descriptive list that is parsed VERY early in the setup
process. Then the hook could be placed (with imports from all apps).

This would help improving my GDAPS plugins system as well, instead of
hacking myself into INSTALLED_APPS within settings.py.

Just my 2 cents.

Christian

--
You received this message because you are subscribed to the Google Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/8188435b-d32d-cc3d-9836-939272ac0de6%40nerdocs.at.
For more options, visit https://groups.google.com/d/optout.

pEpkey.asc (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Discussing improvements of django.setup()

Pakal
hello,

AppConfig could provide hooks, but it'd indeed be already quite late in the setup process : settings are already loaded, logging already configured, script prefix already set, and just accessing AppConfig could already trigger the import of advanced submodules (models etc.), which could break the early setup.

I guess an environment variable, or a naming convention, could allow early hooks similar to those of Gunicorn for example, and unrelated to installed apps.

regards,
Pascal Chambon


On Tuesday, July 2, 2019 at 8:40:04 PM UTC+2, Christian González wrote:

Am 01.07.19 um 23:24 schrieb Pkl:

>
> Regarding django.setup() tweakability, the generic need is simply to
> have a hook, somewhere for users to put early init code, regardless of
> the way django is launched. Code that needs to execute this early are
> mostly (if not all) monkey-patching the environnement, a little like a
> LD_PRELOAD logic python-style.
> [snip]
> There are surely lots of ways to provide such a hook, via new
> settings, or new environment variables, or modules following precise
> naming conventions that django would systematically try to import... I
> have no idea how exactly my approach is rated amongst them.
>
> As for alternatives to these early setup hooks, I'm alas clueless...

Why not a setup() method in the Apps' AppConfig, like ready()? This way
the AppConfig would be used more. Problem here is: when setup runs, it
is loading the settings. And THERE INSTALLED_APPS first time tell Django
which apps are installed. So before that point, it's not possible to 
"import modules from apps following a precise naming convention" etc. Or
did you mean "modules" outside of apps like e.g. a
"django_hook_setup_foo" python module? (Grrrrrr.)

Maybe here could again help to extract the apps list out of settings,
and use a descriptive list that is parsed VERY early in the setup
process. Then the hook could be placed (with imports from all apps).

This would help improving my GDAPS plugins system as well, instead of
hacking myself into INSTALLED_APPS within settings.py.

Just my 2 cents.

Christian

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/7a34d34c-0098-4430-b9af-2bf05244755d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Discussing improvements of django.setup()

Pakal
Hello,

any news about this issue?

Concerning the thread-safety of setup(), the PR is here - https://github.com/django/django/pull/11440

Concerning the tweakability of setup(), I don't get your argument Aymeric: "One more or one less monkey patch isn't going to make a difference to these projects".
That's precisely why we need a hook for custom setup operations. To monkey-patch test environments, apply DCP fixers, setup gevent-like runtimes... for now, there is no single point where one can inject early customization. One needs to change uwsgi.py, maybe manage.py, test launchers, potential scripts...
AppConfig.ready() was introduced so that applications have a single point to initialize signals and the likes, this proposal only extends this to support early-stage setup customization, which is currently missing.
Wouldn't an environment variable, pointing to a custom setup function, do the job?

thanks,
regards,
Pascal


--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/c2bf23f2-ae22-487c-92b9-038e0bcb86cc%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Logging in management commands

Christian González
In reply to this post by Christian González
Hi,

i just stumbled upon logging in management commands I saw that there is
an own system of logging.

When creating custom mgmt cmds, you have to write logging output to

    if options["verbosity"] >= 2:
        sys.stdout.write(message)

this is a little inconvenient, and much less DRY as e.g.

    logger.info(message)

But logger does not really work as intended in commands.

Was this a good choice? Yes, log levels can be changed using settings.py.

But: wouldn't it be convenient to use the system logger for that too in
Django?


My background is: I have made a plugin system, and I would have to add
the "verbosity" parameter to every plugin hook that is ought to print
out some logging strings. It would be a lot easier to use logger.warning
e.g. for that.

Could the 4 verbosity levels just be tied to debug,info, warning, error
of python's logging module as default?

Thanks,
Christian

--
You received this message because you are subscribed to the Google Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/ea45651c-bef9-2b41-5546-1365776c7b2e%40nerdocs.at.

pEpkey.asc (16K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Logging in management commands

Simon Charette
Hello Christian,

I don't have an exact answer for you but there's open tickets about making management
commands use logging instead of custom output wrappers that might interest you.

Simon

[0] https://code.djangoproject.com/ticket/21429
[1] https://code.djangoproject.com/ticket/27877

Le samedi 28 septembre 2019 19:13:01 UTC+2, Christian González a écrit :
Hi,

i just stumbled upon logging in management commands I saw that there is
an own system of logging.

When creating custom mgmt cmds, you have to write logging output to

    if options["verbosity"] >= 2:
        sys.stdout.write(message)

this is a little inconvenient, and much less DRY as e.g.

    <a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flogger.info\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flogger.info\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info(message)

But logger does not really work as intended in commands.

Was this a good choice? Yes, log levels can be changed using settings.py.

But: wouldn't it be convenient to use the system logger for that too in
Django?


My background is: I have made a plugin system, and I would have to add
the "verbosity" parameter to every plugin hook that is ought to print
out some logging strings. It would be a lot easier to use logger.warning
e.g. for that.

Could the 4 verbosity levels just be tied to debug,info, warning, error
of python's logging module as default?

Thanks,
Christian

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/2da9ef10-178c-4173-bd82-061acf8733ca%40googlegroups.com.