romanvm / django-tinymce4-lite

TinyMCE 4 editor widget for Django
MIT License
126 stars 47 forks source link

Lot of "debugging" errors #55

Open gusarg81 opened 5 years ago

gusarg81 commented 5 years ago

Hi,

Is there a way to remove/disable this errors in terninal when runing python manage.py runserver?:

https://pastebin.com/afqdvXXP

I only added English and Spanish dicts in Tinymce settings ('spellchecker_languages': 'English=en_US,Spanish=es').

Thanks.

gusarg81 commented 4 years ago

Hi,

This was fixed in 1.7.5? Because I still see all those debug messages. Thanks.

gusarg81 commented 4 years ago

Bump.

EDIT: for now all those info messages disappeared when add LANGUAGES to settings.py, but now there is one only message left to disable:

[2019-11-07 22:11:09,823] widgets: INFO - Enchant languages: ['en', 'en_AU', 'en_CA', 'en_GB', 'en_US', 'es_AR', 'es_ES', 'es_UY', 'es_CU', 'es_VE', 'es_BO', 'es_PE', 'es_CL', 'es_DO', 'es_PA', 'es_NI', 'es_GT', 'es_PY', 'es_PR', 'es_CR', 'es_US', 'es_SV', 'es_CO', 'es_MX', 'es_HN', 'es_EC']

Sorry to ask it again, is there currently a way to set debugging messages?

Thanks.

merwok commented 4 years ago

I don’t know if these are warnings or logging messages, but there are ways to configure both from your app:

gusarg81 commented 4 years ago

Right, but I already have a setup for my Project. At least in my case, is everything is working good with TinyMCE lite, would be good to have an option to disable these logs which comes from TinyMCE Lite.

merwok commented 4 years ago

I am saying that you do have an option!

gusarg81 commented 4 years ago

Yeah, but I don't want to modify what is set for my current Project (unless there is a way to specify Django logs for a certain app). Thanks anyways.

merwok commented 4 years ago

Yes, you can modify logging config for a specific logger.

romanvm commented 4 years ago

The log record in question is created only in debug mode: https://github.com/romanvm/django-tinymce4-lite/blob/master/tinymce/widgets.py#L96 so it shouldn't be logged in production. If you are running Django with debug enabled in production, this is your least issue.

gusarg81 commented 4 years ago

And why you assume that in production I am running it in debug mode? I never mention that, which of course I do not use debug mode in production. The problem, and very annoying, is to see all those lines mixed with what I really care of my project.

romanvm commented 4 years ago

As you can see in the code, the log record in question is guarded by if settings.DEBUG: condition and should not occur with `DEBUG = False'

romanvm commented 4 years ago

In the latest version the logging logic has been changed and the issue should not happen any more.

gusarg81 commented 4 years ago

Hi,

Fixed in version 1.8.0? Because still:

widgets: DEBUG - Enchant languages: ['es_NI', 'es_BO', 'es_MX', 'es_CR', 'es_GT', 'es_AR', 'es_SV', 'es_PE', 'es_PA', 'es_CL', 'es_DO', 'es_ES', 'es_HN', 'en_US', 'es_UY', 'es_US', 'es_CU', 'es_VE', 'es_EC', 'es_CO', 'es_PY', 'es_PR', 'en', 'en_AU', 'en_CA', 'en_GB']

romanvm commented 4 years ago

Again, I can only recommend to check your project configuration. The message has DEBUG level and should not appear under normal circumstances. E.g. it does not appear in the test project with DEBUG = False.

georgekpg commented 4 years ago

Hi! I have the same problem - a lot of debugging level log messages in console in any django management command.

The reason of the problem is logging.basicConfig() call in views.py and widgets.py modules. After I have commented these out, the problem disappeared.

Maybe, the call should not be at module level?

This is what I found and commented out in version 1.8.0:

/myvenv/lib/python3.6/site-packages/tinymce/widgets.py:29:logging.basicConfig(format='[%(asctime)s] %(module)s: %(levelname)s - %(message)s') /myvenv/lib/python3.6/site-packages/tinymce/views.py:21:logging.basicConfig(format='[%(asctime)s] %(module)s: %(levelname)s - %(message)s')

gusarg81 commented 4 years ago

This is the way finally used to avoid this "non important" debug logs in LOGGING settings (skipped here no necesary settings):

LOGGING = { ...

'handlers': { ... 'tinymce_console': { 'class': 'logging.StreamHandler', 'level': 'INFO' }, },

'loggers': { ... 'tinymce.widgets': { 'handlers': ['tinymce_console'], 'level': 'INFO', 'propagate': False, } } }