public void processEvent(Event event) { String msg = EventFormatter.format(event); EventSeverity severity = event.getSeverity(); if (severity == EventSeverity.INFO) { // logger.info(filename + ": " + msg); } else if (severity == EventSeverity.WARN) { // logger.warn(filename + ": " + msg); } else if (severity == EventSeverity.ERROR) { logger.error(filename + ": " + msg); } else if (severity == EventSeverity.FATAL) { logger.fatalError(filename + ": " + msg); } else { assert false; } }
/** This does the actual authentication using the teamspace authentication component. */ private String authenticateUser(HttpServletRequest request) { String authHeader = request.getHeader("Authorization"); String authenticatedUser = null; if ((authHeader != null) && authHeader.toUpperCase().startsWith("BASIC")) { String[] authTuple = authTupleFromAuthHeader(authHeader); if (authTuple.length == 2) { String username = authTuple[0]; String password = authTuple[1]; if (lookupAuthentication().authenticate(username, password)) { authenticatedUser = username; } else { log_.info( "failed authentication" + " from host: " + request.getRemoteAddr() + " with username: " + username); } } } return authenticatedUser; }
/* (non-Javadoc) * @see org.plj.chanells.febe.msg.MessageFactory#sendMessage(org.pgj.messages.Message, org.plj.chanells.febe.core.PGStream) */ public void sendMessage(Message msg, PGStream stream) throws IOException, MappingException, CommunicationException { SQL sql = (SQL) msg; String clname = msg.getClass().getName(); AbstractSQLMessageFactory msgf = (AbstractSQLMessageFactory) map.get(clname); if (msgf == null) { logger.fatalError("sender method not implemented for " + clname); throw new CommunicationException("sender method not implemented for " + clname); } stream.SendInteger(msgf.getSQLType(), 4); msgf.sendMessage(msg, stream); }
/** * Creation of a new HelloComponent instance using a container supplied logging channel and * context. The context supplied by the container holds the standard context entries for the home * and working directories, component name and partition. * * @avalon.entry key="urn:avalon:name" * @avalon.entry key="urn:avalon:partition" * @avalon.entry key="urn:avalon:home" type="java.io.File" * @avalon.entry key="urn:avalon:temp" type="java.io.File" */ public HelloComponent(Logger logger, Context context) throws ContextException { m_logger = logger; m_home = (File) context.get("urn:avalon:home"); m_temp = (File) context.get("urn:avalon:temp"); m_name = (String) context.get("urn:avalon:name"); m_partition = (String) context.get("urn:avalon:partition"); StringBuffer buffer = new StringBuffer("standard context entries"); buffer.append("\n name: " + m_name); buffer.append("\n home: " + m_home); buffer.append("\n temp: " + m_temp); buffer.append("\n partition: " + m_partition); m_logger.info(buffer.toString()); }
public Logger getChildLogger(String message) { return realLogger.getChildLogger(message); }
public boolean isErrorEnabled() { return isThrowingException(ERROR_VALUE) || realLogger.isErrorEnabled(); }
public boolean isWarnEnabled() { return isThrowingException(WARN_VALUE) || realLogger.isWarnEnabled(); }
public boolean isInfoEnabled() { return isThrowingException(INFO_VALUE) || realLogger.isInfoEnabled(); }
public boolean isDebugEnabled() { // Enable level also if it is set to throw an exception, so that // logging the message occurs, and then throws it. return isThrowingException(DEBUG_VALUE) || realLogger.isDebugEnabled(); }
public void fatalError(String message, Throwable thr) { realLogger.fatalError(message, thr); throwException(FATAL_VALUE, message); }
public void error(String message, Throwable thr) { realLogger.error(message, thr); throwException(ERROR_VALUE, message); }
public void warn(String message, Throwable thr) { realLogger.warn(message, thr); throwException(WARN_VALUE, message); }
public void info(String message, Throwable thr) { realLogger.info(message, thr); throwException(INFO_VALUE, message); }
public void debug(String message, Throwable thr) { realLogger.debug(message, thr); throwException(DEBUG_VALUE, message); }