public void writeLog(
      Object obj_request,
      String msg,
      String userIP,
      String userMatricola,
      String classFrom,
      String level)
      throws IOException {
    if (obj_request == null || !(obj_request instanceof HttpServletRequest)) return;
    HttpServletRequest request = (HttpServletRequest) obj_request;
    i_log_pattern_web logPattern = patternFactory(init.get_LogPattern());
    if (logPattern == null) logPattern = new log_patternSimple();
    String log_mess = logPattern.prepare(request, msg, userIP, userMatricola, classFrom, level);

    util_format.writeToConsole(init, log_mess);

    if (logStub == null) logStub = stubFactory(init);
    if (logStub != null) {
      logStub.write(prepare4stub(log_mess, null, null, request, null, level, userMatricola));
    } else {
      if (init.isStackLevel(level)) {
        instance.add(log_mess);
      }
    }
  }
  public void writeLog(String msg, String level) throws IOException {
    i_log_pattern logPattern = patternFactory(init.get_LogPattern());
    if (logPattern == null) logPattern = new log_patternSimple();
    String log_mess = logPattern.prepare(msg, level);

    util_format.writeToConsole(init, log_mess);

    if (logStub == null) logStub = stubFactory(init);
    if (logStub != null) {
      logStub.write(prepare4stub(log_mess, null, null, null, null, level, null));
    } else {
      instance.add(log_mess);
    }
  }