def _log_category_message(jlogger, message, *args, **kwargs):
    method = kwargs.get('method_name', None)
    clazz = kwargs.get('class_name', None)
    record = JLogRecord(jlogger.getLevel(), message)
    record.setLoggerName(jlogger.getName())
    record.setMillis(JSystem.currentTimeMillis())
    record.setParameters(list(*args))
    record.setResourceBundle(jlogger.getResourceBundle())
    if clazz is not None:
        record.setSourceClassName(clazz)
    if method is not None:
        record.setSourceMethodName(method)
    record.setThreadID(int(JThread.currentThread().getId()))
    jlogger.log(record)
    return
Exemple #2
0
 def findRightState(self, mobObjectId):
     st1 = None
     if self.Spawn_List[mobObjectId][0] == None:
         record = LogRecord(
             Level.WARNING,
             "Founded NPE at findRightState() - npcObjectId: " +
             str(mobObjectId))
         record.setLoggerName("SagasSuperclass")
         _log.log(record)
         return None
     playerName = self.Spawn_List[mobObjectId][
         0]  #There is a possibility for an NPE here, but only if something else is wrong in the quest
     st1 = L2World.getInstance().getPlayer(
         playerName
     )  #Therefore, placing an NPE catch here will only hide the error, not solve it.
     if st1: st1 = st1.getQuestState(self.qn)
     return st1
Exemple #3
0
    def __get_log_record(self, level, clazz, method, message, error, *args):
        record = JLogRecord(level, message)
        record.setLoggerName(self.name)
        record.setMillis(JSystem.currentTimeMillis())
        record.setParameters(_get_args_as_java_array(*args))
        if self.resource_bundle_name is not None:
            record.setResourceBundle(self.logger.getResourceBundle())
        if clazz is not None:
            record.setSourceClassName(clazz)
        if method is not None:
            record.setSourceMethodName(method)
        record.setThreadID(int(JThread.currentThread().getId()))
        if error is not None:
            if isinstance(error, Throwable):
                record.setThrown(error)
            else:
                ex = exception_helper.convert_error_to_exception()
                record.setThrown(ex)

        return record