I am using python logging module for logging purpose and i am storing those logs in to a log file using logging.FileHandler.
I am able to collect all logs in log file, but robot framework is printing [ ERROR ], [ WARN ] logs in log file as well as in log file also.
How can i disable that option in robo to stop printing console error logs.
*** Test Cases ***
ROBO-LOG
log to console ********** TESTING LOGGING ************
TEST_LOGGER
####################################
TEST_LOGGER function in a py file:
import logging
def TEST_LOGGER():
logObj = logging.getLogger('tmp.log')
test_log_handler = logging.FileHandler('/tmp/tmp.log' , mode='w')
formatter = logging.Formatter(fmt='%(asctime)s - %(levelname)s - %(message)s')
test_log_handler.setFormatter(formatter)
logObj.addHandler(test_log_handler)
logObj.setLevel(logging.DEBUG)
logObj.debug('debug log')
logObj.info('info log')
logObj.warning('warning log')
logObj.error('error log')
logObj.critical('critical log')
CONSOLE O/P:
[root@localhost practice]# pybot -t ROBO-LOG testrobo.txt
==============================================================================
Testrobo
==============================================================================
ROBO-LOG
********** PRINTING IN CONSOLE ************
[ WARN ] warning log
[ ERROR ] error log
[ ERROR ] critical log
ROBO-LOG | PASS |
------------------------------------------------------------------------------
Testrobo | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
HOW CAN I STOP PRINTING THOSE ERROR MESSAGES IN CONSOLE ?
Thanks in advance,
masthan chowdary