Modify

Ticket #419 (closed defect: wontfix)

Opened 4 years ago

Last modified 22 months ago

south logging misbehaves.

Reported by: anonymous Owned by: andrew
Priority: major Milestone: 0.7.1
Component: commands Version: 0.7
Keywords: Cc:

Description

problem

south logging sets its own debug level. (and worse it sets it to a low level: DEBUG)

This causes south to flood our logging, without the possibility to shut it down.

We have our own logging configuration but even setting south logging to CRITICAL, or ERROR, does not help south.DEBUG logs keep coming out.

The fix is easy (below). Just don't interface with the loglevels at all from within an app, that is for the site to define.

result

logs gets clogged up with stuff like

2010-04-09 13:44:46,005 - south - DEBUG - south execute "CREATE TABLE `epsso_api_apiclient` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `key` varchar(100) NOT NULL, `site_id` integer NOT NULL);" with params "[]"
2010-04-09 13:44:46,005 - south - DEBUG - south execute "CREATE TABLE `epsso_api_apiclient` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `key` varchar(100) NOT NULL, `site_id` integer NOT NULL);" with params "[]"
2010-04-09 13:44:46,005 - south - DEBUG - south execute "ALTER TABLE `epsso_api_apiclient` ADD CONSTRAINT `site_id_refs_id_569cff646ffec61c` FOREIGN KEY (`site_id`) REFERENCES `epsso_core_site` (`id`);" with params "[]"
2010-04-09 13:44:46,005 - south - DEBUG - south execute "ALTER TABLE `epsso_api_apiclient` ADD CONSTRAINT `site_id_refs_id_569cff646ffec61c` FOREIGN KEY (`site_id`) REFERENCES `epsso_core_site` (`id`);" with params "[]"
2010-04-09 13:44:46,009 - south - DEBUG - south execute "CREATE INDEX `epsso_api_apiclient_site_id` ON `epsso_api_apiclient` (`site_id`);" with params "[]"
2010-04-09 13:44:46,009 - south - DEBUG - south execute "CREATE INDEX `epsso_api_apiclient_site_id` ON `epsso_api_apiclient` (`site_id`);" with params "[]"

patch

--- logger.py   2010-04-09 13:47:07.000000000 +0200
+++ virtualenv/lib/python2.5/site-packages/south/logger.py      2010-04-09 13:47:10.000000000 +0200
@@ -9,7 +9,6 @@

 _logger = logging.getLogger("south")
 _logger.addHandler(NullHandler())
-_logger.setLevel(logging.DEBUG)

 def get_logger():
     "Attach a file handler to the logger if there isn't one already."

Attachments

Change History

comment:1 Changed 4 years ago by andrew

  • Status changed from new to infoneeded
  • Milestone set to 0.7.1

If that line is removed, however, people won't see the messages in the South log, if they enable it, since the level won't have been set to DEBUG (remember, most people don't use the logging framework for other things).

Why not configure your handlers to ignore things from the "south" logger? The logging framework in Python is pretty flexible, for this reason.

comment:2 Changed 4 years ago by andrew

  • Status changed from infoneeded to closed
  • Resolution set to wontfix

comment:3 Changed 4 years ago by fcamel@…

Hi Andrew,

I have the same issue. Could you please give some hint about how to ignore "south" logger? My temporal solution is to reset the south logging level:

import south.logger
logging.getLogger('south').setLevel(logging.CRITICAL)

The above "import south.logger" is required because if south.logger is imported after my setLevel(), the level is "reset" to DEBUG.

Thanks.

comment:4 Changed 4 years ago by andrew

That works; you can also remove the handler, or add a filter which doesn't let it through; see http://docs.python.org/library/logging.html#logger-objects and http://docs.python.org/library/logging.html#logging.Filter

(I can't see a better way to silence it, and two lines of logging configuration is going to be quite sensible if you already have logging set up).

comment:5 follow-up: ↓ 6 Changed 3 years ago by w@…

Hi. Why is this issue marked wontfix?

If more than one library forcefully output debug messages without providing a way to configure logging we would have a big problem getting useful info.

This is clearly anti-social behavior.

comment:6 in reply to: ↑ 5 Changed 3 years ago by andrew

Replying to w@…:

Hi. Why is this issue marked wontfix?

If more than one library forcefully output debug messages without providing a way to configure logging we would have a big problem getting useful info.

This is clearly anti-social behavior.

Because you can easily change the log level setting yourself, in your own code? As I explained above, we have to code by default for the case where people aren't using logging.

comment:7 Changed 2 years ago by davidb

This does not conform to the normal standards of other libraries. Could you at least change the code to:

if not _logger.level:
  _logger.setLevel(logging.DEBUG

that way the standard config would at least take precedence

comment:8 Changed 23 months ago by vdboor@…

+1 for me. Fora at the internet are already suggesting to do stuff like import south.logger in settings.py as workaround so you can redefine the logger level. Better have the proper fix in south instead. :-)

comment:9 Changed 23 months ago by anonymous

andrew: you do not need to code for the case where people do not use their own logging config.

If people want to see your log output, they will enable it themselves. Just spraying your own settings over global config is indeed clearly anti-social behavior.

Especially when south generates SO MUCH logspam.

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.