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 LogGenerator_CdiOnlySession(log_init _init) {
    super();
    this.init = _init;
    logStub = stubFactory(init.get_LogStub());
    try {
      if (init == null) throw new Exception("Log INIT is NULL");
      if (init.get_LogPath() == null) throw new Exception("Log INIT->LogPath is NULL");

    } catch (Exception e) {
      readError = true;
      //		   	bsController.writeLog("Load_log ERROR:"+e.toString(),iStub.log_ERROR);
      util_format.writeToConsole(_init, "Load_log ERROR: " + e.toString());
      return;
    }
  }
  public void writeLog(
      String msg, String userIP, String userMatricola, String classFrom, 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, 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, null, null, level, userMatricola));
    } else {
      if (init.isStackLevel(level)) {
        instance.add(log_mess);
      }
    }
  }
 public void setInit(log_init _init) {
   this.init = _init;
   logStub = stubFactory(init.get_LogStub());
   try {
     readError = true;
   } catch (Exception e) {
     readError = true;
     //		   	bsController.writeLog("Load_log ERROR:"+e.toString(),iStub.log_ERROR);
     util_format.writeToConsole(_init, "Load_log ERROR: " + e.toString());
     return;
   }
 }
  private iStub stubFactory(log_init _init) {

    String className = _init.get_LogStub();
    if (className == null || className.equals("")) return null;

    if (logStub == null) {
      try {
        logStub =
            (iStub)
                util_provider.getInstanceFromProvider(
                    new String[] {
                      bsController.getAppInit().get_context_provider(),
                      bsController.getAppInit().get_cdi_provider(),
                      bsController.getAppInit().get_ejb_provider()
                    },
                    className);
      } catch (Exception e) {
        logStub = null;
      }
    }
    return logStub;
  }
 public iStub get_log_Stub() {
   return stubFactory(init.get_LogStub());
 }
 public i_log_pattern get_log_Pattern() {
   return patternFactory(init.get_LogPattern());
 }