/** * Log a message object at level VERBOSE. * * @param msg * - the message object to be logged */ @Override public void trace(String msg) { if (this.logger.getIsShowDebugMessages()) { this.logger.debug(null, getClass(), msg); } }
/** * Log a message object at the INFO level. * * @param msg * - the message object to be logged */ @Override public void info(String msg) { this.logger.info(null, getClass(), msg); }
/** * <p>Checks if request public.</p> * @param pReq request * @return if public * @throws Exception - an exception **/ public final Boolean evaluate( final HttpServletRequest pReq) throws Exception { String nameHandler = pReq.getParameter("nmHnd"); if (this.publicHandlerNames.contains(nameHandler)) { return Boolean.TRUE; } this.logger.error(null, CheckerPublicReqHndl.class, nameHandler + " IS NOT PUBLIC!!!"); if (this.logger.getIsShowDebugMessages() && this.logger.getDetailLevel() > 10000) { StringBuffer sb = new StringBuffer("Public handlers: "); for (String nmHnd : this.publicHandlerNames) { sb.append("/" + nmHnd); } this.logger.debug(null, CheckerPublicReqHndl.class, sb.toString()); } return Boolean.FALSE; }
/** * <p>Setter for logger.</p> * @param pLogger reference **/ public final void setLogger(final ILogger pLogger) { this.logger = pLogger; this.isShowDebugMessages = this.logger .getIsShowDebugMessagesFor(getClass()); this.logDetailLevel = this.logger.getDetailLevel(); }
/** * <p>Execute any SQL query that returns no data. * E.g. PRAGMA, etc.</p> * @param pQuery query * @throws ExceptionWithCode - if an exception occured **/ @Override public final void executeQuery(final String pQuery) throws Exception { try { if (getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000) { getLogger().debug(null, SrvDatabase.class, "try to execute query: " + pQuery); } this.sqliteDatabase.execSQL(pQuery); } catch (Exception ex) { String msg = ex.getMessage() + ", query:\n" + pQuery; ExceptionWithCode ewc = new ExceptionWithCode(SrvDatabase.SQL_EXEC_ERROR, msg); ewc.setStackTrace(ex.getStackTrace()); throw ewc; } }
/** * Logs a message with trace log level. * * @param message log this message */ @Override public final void trace(final Object msg) { String sMsg = msg == null ? "TRACE???" : msg.toString(); this.logger.debug(null, getClass(), sMsg); }
/** * <p>Rollback transaction to savepoint.</p> * @param pSavepointName savepoint name * @throws Exception - an exception **/ @Override public final void rollBackTransaction(final String pSavepointName) throws Exception { if (getLogger().getIsShowDebugMessagesFor(getClass())) { getLogger().debug(null, SrvDatabase.class, "try to rollback to savepoint: " + pSavepointName); } this.threadConnection.get(). rollback(savepointsMap.get(pSavepointName)); savepointsMap.remove(pSavepointName); }
/** * Log a message object at the ERROR level. * * @param msg * - the message object to be logged */ @Override public void error(String msg) { this.logger.error(null, getClass(), msg); }
/** * <p>Default initializer that load message bundle by default locale.</p> **/ public final void initDefault() { try { this.messages = null; this.messages = ResourceBundle.getBundle("Messages"); } catch (Exception e) { this.logger.error(null, SrvI18n.class, " when loading msgs for default locale ", e); } if (messages != null) { this.messagesMap.put(Locale.getDefault().getLanguage(), this.messages); this.logger.info(null, SrvI18n.class, "Added messages for default locale: " + Locale.getDefault()); } else { //If there is no MessagesBundle[current-locale].properties this.logger.error(null, SrvI18n.class, "There is no messages for current locale: " + Locale.getDefault()); } }
final String pFileName) throws Exception { this.isShowDebugMessages = this.logger .getIsShowDebugMessagesFor(getClass()); String nameBaseXml = "/" + pDirName + "/" + pFileName; this.logger.info(null, MngSettings.class, "try to load: " + nameBaseXml); LinkedProperties props = this.utlProperties.loadPropertiesXml(nameBaseXml); if (props == null) { + " in base configuration file!"); this.logger.info(null, MngSettings.class, "classes: " + strClasses); LinkedHashSet<String> classesNames = this.utlProperties
/** * <p>Get SrvDatabase in lazy mode.</p> * @return SrvDatabase - SrvDatabase * @throws Exception - an exception */ @Override public final synchronized ILogger lazyGetLogger() throws Exception { if (this.logger == null) { this.logger = new LoggerStandard(); this.logger.setIsShowDebugMessages(getIsShowDebugMessages()); lazyGetLogger().info(AFactoryAppBeans.class, "LoggerStandard has been created."); } return this.logger; }
+ pReq.getRemoteAddr() + "/" + pReq.getRemotePort() + "/" + pReq.getRemoteHost() + "/" + flCountAttempt; logger.warn(null, SessionTracker.class, msg); } else { + pReq.getRemoteAddr() + "/" + pReq.getRemotePort() + "/" + pReq.getRemoteHost() + "/" + flCountAttempt; logger.error(null, SessionTracker.class, msg);
/** * Log an exception (throwable) at the INFO level with an accompanying * message. * * @param msg * the message accompanying the exception * @param t * the exception (throwable) to log */ @Override public void info(String msg, Throwable t) { this.logger.warn(null, getClass(), msg, t); }
/** * <p>Get is show debug messages.</p> * @throws Exception - an exception * @return is show debug messages? **/ @Override public final boolean getIsShowDebugMessages() throws Exception { return this.logger.getIsShowDebugMessages(); }
/** * <p>Get is show debug messages for this class.</p> * @param pClazz of bean * @throws Exception - an exception * @return is show debug messages? **/ @Override public final boolean getIsShowDebugMessages( final Class<?> pClazz) throws Exception { return this.logger.getIsShowDebugMessagesFor(pClazz); }
/** * <p>Get preferred detail level, e.g. for suppress unwanted * debug messages for deep level #3: * <pre> * if (this.logger.getIsShowDebugMessagesFor(this.getClass()) * && this.logger.getDetailLevel() >= 3) { * ... 3-d detail level message * } * </pre> * </p> * @return preferred detail level * @throws Exception - an exception **/ @Override public final int getDetailLevel() throws Exception { return this.logger.getDetailLevel(); }
/** * <p>Execute any SQL query that returns no data. * E.g. PRAGMA, etc.</p> * @param pQuery query * @throws Exception - an exception **/ @Override public final void executeQuery(final String pQuery) throws Exception { Statement stmt = null; try { if (getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000) { getLogger().debug(null, SrvDatabase.class, "Thread ID=" + Thread.currentThread().getId() + ", try to execute query: " + pQuery); } stmt = getOrEstablishConnection().createStatement(); stmt.executeUpdate(pQuery); } catch (SQLException sqle) { String msg = sqle.getMessage() + ", RDBMS error code " + sqle.getErrorCode() + ", query:\n" + pQuery; throw new ExceptionWithCode(ASrvDatabase.SQL_EXEC_ERROR, msg); } finally { if (stmt != null) { stmt.close(); } } }
/** * <p>Rollback transaction to savepoint.</p> * @param pSavepointName savepoint name * @throws Exception - an exception **/ @Override public final void rollBackTransaction(final String pSavepointName) throws Exception { getLogger().debug(SrvDatabase.class, "try to rollback to savepoint: " + pSavepointName); this.threadConnection.get(). rollback(savepointsMap.get(pSavepointName)); savepointsMap.remove(pSavepointName); }
/** * <p>Rollback transaction to savepoint.</p> * @param pSavepointName savepoint name * @throws Exception - an exception **/ @Override public final void rollBackTransaction(final String pSavepointName) throws Exception { //according https://code.google.com/p/android/issues/detail?id=38706 //its very easy to make simple things complicated if (getLogger().getIsShowDebugMessagesFor(getClass())) { getLogger().debug(null, SrvDatabase.class, "try to rollback to savepoint: " + pSavepointName); } executeQuery(";ROLLBACK TRANSACTION TO SAVEPOINT " + pSavepointName + ";"); }