Die Hinrichtung von Robot Framework nimmt, wo Test.py
als Bibliothek importiert wurde und testLog()
ausgeführt wird, was wiederum die Einfuhren Logger.py
und LogMessage()
nennt.Logs mehrere Zeit gedruckt zu werden mit Filehandler in Python
Test.py
import Logger
def testLog():
Logger.LogMessage("This is the first line of the log file.")
Logger.LogMessage("This is the second line of the log file.")
Logger.LogMessage("This is the third line of the log file.")
Logger.py
import logging
def LogMessage(message):
LOG_FILENAME = "C://Log_Details".log"
logger = logging.getLogger()
logFileHandler = logging.FileHandler(LOG_FILENAME)
logger.addHandler(logFileHandler)
Log_Details.log
This is the first line of the log file.
This is the second line of the log file.
This is the second line of the log file.
This is the third line of the log file.
This is the third line of the log file.
This is the third line of the log file.
Der Meldungslog Abschnitt in RIDE jede Zeile nur einmal während der Ausführung anmeldet, aber die Datei mit dem Namen Log_details.log
druckt sie mehrmals, dh die 1. Zeile wird einmal eingeloggt, während die 2. wird doppelt geloggt und so weiter.