Welcome!
This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.
Utilizando Logs do sistema
O sistema disponibiliza um sistema de logs para ajudar na comunicação do que está sendo executado no sistema, para utiliza-lo em qualquer aplicação python use da seguinte forma.
Tipos : debug, info, warning, error, critical.
import logging
import sys
_logger = logging.getLogger(__name__)
LEVELS = {'debug': logging.DEBUG,
'info': logging.INFO,
'warning': logging.WARNING,
'error': logging.ERROR,
'critical': logging.CRITICAL}
if len(sys.argv) > 1:
level_name = sys.argv[1]
level = LEVELS.get(level_name, logging.NOTSET)
logging.basicConfig(level=level)
_logger.debug('This is a debug message')
_logger.info('This is an info message')
_logger.warning('This is a warning message')
_logger.error('This is an error message')
_logger.critical('This is a critical error message')
O Logger é bem útil pra "debugar" nos servidores de QA e produção.
Pra complementar, no Odoo os tipos de mensagens que vão parecer no terminal depende do nível configurado no arquivo .conf
(ex: log_level = warn) ou do parametro do comando de execução do odoo (ex: --log-level=debug).
É possivel salvar essas mensagens de log em um arquivo definido no campo logfile no arquivo .conf ou no parâmetro --logfile. Nos servidores esse arquivo geralmente fica em /var/log/odoo/odoo-server.log e pode ser monitorado através do comando sudo tail -f /var/log/odoo/odoo-server.log
Your Answer
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
Keep Informed
About This Community
Moderation Tools
Question tools
Stats
Asked: 10/14/21, 9:05 PM |
Seen: 548 times |
Last updated: 10/15/21, 11:07 PM |