def get_LogRequests_ByRange(sYear, sMonth, sDay, eYear, eMonth, eDay):
    # Parse start and end times into datetimes
    dateTimeFormat = "%Y_%m_%d"
    if (len(str(sMonth)) == 1):
        sMonth = "0" + str(sMonth)
    if (len(str(eMonth)) == 1):
        eMonth = "0" + str(eMonth)
    if (len(str(sDay)) == 1):
        sDay = "0" + str(sDay)
    if (len(str(eDay)) == 1):
        eDay = "0" + str(eDay)
    sDateTimeString = str(sYear) + "_" + str(sMonth) + "_" + str(sDay)
    eDateTimeString = str(eYear) + "_" + str(eMonth) + "_" + str(eDay)
    dateTime_Early = datetime.datetime.strptime(sDateTimeString,
                                                dateTimeFormat)
    dateTime_Late = datetime.datetime.strptime(eDateTimeString, dateTimeFormat)

    # Get the logs
    retLogs = []  # Scoping
    try:
        rLog = reqLog.requestLog()
        retLogs = rLog.get_RequestData_ByRange(dateTime_Early, dateTime_Late)
    except:
        e = sys.exc_info()[0]
        errorMsg = "ERROR get_LogRequests_ByRange: There was an error trying to get the logs.  System error message: " + str(
            e)
        logger.error(errorMsg)
    return retLogs
Esempio n. 2
0
 def __write_JobStarted_To_DB__(self, uniqueid, objectInfo):
     try:
         theID = uniqueid
         theStatusNote = "JobStarted"
         theAdditionalNotes = "Server Job: " + str(
             theID) + " has started :: Object Info: " + str(objectInfo)
         rLog = reqLog.requestLog()
         rLog.logger = self.logger
         rLog.add_New_ServerSide_Request(theID, theStatusNote,
                                         theAdditionalNotes)
     except:
         pass
Esempio n. 3
0
 def __write_JobError_To_DB__(self, uniqueid, errorMessage, objectInfo):
     try:
         theID = uniqueid
         theStatusNote = "JobError"
         theAdditionalNotes = "Server Job: " + str(
             theID) + " had an Error.  Error Message: " + str(
                 errorMessage) + " :: Object Info: " + str(objectInfo)
         rLog = reqLog.requestLog()
         rLog.logger = self.logger
         rLog.add_New_ServerSide_Request(theID, theStatusNote,
                                         theAdditionalNotes)
     except:
         pass
def set_LogRequest(theRequest, theIP):

    # Many params come with this
    # To add more items that should be logged, edit the function 'decode_Request_For_Logging' found in requestLog.py
    theRequestObj = None  # Scoping
    try:
        rLog = reqLog.requestLog()
        rLog.logger = logger
        theRequestObj = rLog.decode_Request_For_Logging(theRequest, theIP)
        rLog.add_New_Request(theRequestObj)
        logger.info("Request Logged!")
    except:
        e = sys.exc_info()[0]
        errorMsg = "ERROR set_LogRequest: There was an error trying to log this request.  System error message: " + str(
            e)  # + " Object Details: " + str(theRequest)
        logger.error(errorMsg)

    return theRequestObj