Java Code Examples for org.slf4j.Logger

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project almira-sample, under directory /almira-sample-core/src/main/java/almira/sample/util/.

Source file: LogPostProcessor.java

  18 
vote

@Override public Object postProcessBeforeInitialization(final Object bean,String beanName){
  ReflectionUtils.doWithFields(bean.getClass(),new FieldCallback(){
    @Override public void doWith(    Field field) throws IllegalAccessException {
      ReflectionUtils.makeAccessible(field);
      if (field.getAnnotation(Log.class) != null) {
        Logger logger=LoggerFactory.getLogger(bean.getClass().getName());
        field.set(bean,logger);
      }
    }
  }
);
  return bean;
}
 

Example 2

From project bonecp, under directory /bonecp/src/test/java/com/jolbox/bonecp/.

Source file: TestUtils.java

  18 
vote

/** 
 * Creates a mock logger, sets it in the specified class, and returns it for configuration.
 * @param loggingClass the class with a private static final Logger
 * @return the mocked logger
 * @throws Exception if anything goes wrong
 */
static Logger mockLogger(Class loggingClass) throws NoSuchFieldException, IllegalAccessException {
  Logger mockLogger=createNiceMock(Logger.class);
  Field field=loggingClass.getDeclaredField("logger");
  setFinalStatic(field,mockLogger);
  return mockLogger;
}
 

Example 3

From project dimdwarf, under directory /dimdwarf-core/src/test/java/net/orfjackal/dimdwarf/db/inmemory/.

Source file: InMemoryDatabaseSpec.java

  18 
vote

public void create() throws Exception {
  dbms=new InMemoryDatabaseManager();
  Logger txLogger=mock(Logger.class);
  tx1=new TransactionContext(txLogger);
  tx2=new TransactionContext(txLogger);
  specify(dbms.getOpenConnections(),should.equal(0));
}
 

Example 4

From project empire-db, under directory /empire-db-codegen/src/test/java/org/apache/empire/db/codegen/util/.

Source file: DBUtilTest.java

  18 
vote

@Test public void testCloseResultSet() throws SQLException {
  Logger log=Mockito.mock(Logger.class);
  boolean succes=DBUtil.close((ResultSet)null,log);
  assertTrue(succes);
  ResultSet rs=Mockito.mock(ResultSet.class);
  boolean succes2=DBUtil.close(rs,log);
  assertTrue(succes2);
  ResultSet rsFail=Mockito.mock(ResultSet.class);
  Exception exception=new SQLException("test");
  Mockito.doThrow(exception).when(rsFail).close();
  boolean succes3=DBUtil.close(rsFail,log);
  assertFalse(succes3);
  Mockito.verify(log).error("The resultset could not be closed!",exception);
}
 

Example 5

From project fiftyfive-wicket, under directory /fiftyfive-wicket-core/src/main/java/fiftyfive/wicket/.

Source file: FoundationApplication.java

  18 
vote

/** 
 * Enables Wicket's request logging facility if an SLF4J logger is configured for  {@code INFO} with the category{@code org.apache.wicket.protocol.http.RequestLogger}. For example, if using log4j properties configuration, this would cause the Wicket request logger to be enabled: <pre class="example"> log4j.logger.org.apache.wicket.protocol.http.RequestLogger = INFO</pre>
 * @since 2.0
 */
protected void initRequestLogger(){
  Logger log=LoggerFactory.getLogger(RequestLogger.class);
  if (log.isInfoEnabled()) {
    getRequestLoggerSettings().setRequestLoggerEnabled(true);
  }
}
 

Example 6

From project flatpack-java, under directory /core/src/test/java/com/getperka/flatpack/util/.

Source file: LogChunkerTest.java

  18 
vote

private Logger expectLogs(String... messages){
  Logger logger=createStrictMock(Logger.class);
  expect(logger.isInfoEnabled()).andReturn(true).anyTimes();
  for (  String message : messages) {
    logger.info(message);
    expectLastCall();
  }
  replay(logger);
  return logger;
}
 

Example 7

From project framework, under directory /impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/.

Source file: CoreBootstrap.java

  18 
vote

public void engineOn(@Observes final BeforeBeanDiscovery event,BeanManager beanManager){
  String description;
  Logger log=getLogger();
  description=getBundle().getString("engine-on");
  log.info(description);
  Beans.setBeanManager(beanManager);
  description=getBundle().getString("setting-up-bean-manager",Beans.class.getCanonicalName());
  log.info(description);
}
 

Example 8

From project https-utils, under directory /src/main/java/org/italiangrid/utils/https/.

Source file: JettyRunThread.java

  18 
vote

/** 
 * {@inheritDoc} 
 */
public void run(){
  try {
    httpServer.start();
    httpServer.join();
  }
 catch (  Exception e) {
    Logger log=LoggerFactory.getLogger(JettyRunThread.class);
    log.error("Unable to start service, shutting down",e);
    e.printStackTrace();
    System.exit(1);
  }
}
 

Example 9

From project iudex_1, under directory /iudex-jetty-httpclient/src/main/java/iudex/jettyhttpclient/.

Source file: Client.java

  18 
vote

public void dump(){
  Logger log=LoggerFactory.getLogger("iudex.jettyhttpclient.Dumper");
  if (log.isDebugEnabled()) {
    log.debug("Jetty Client Dump ::\n{}",_client.dump());
  }
}
 

Example 10

From project james, under directory /lifecycle-spring/src/main/java/org/apache/james/container/spring/lifecycle/.

Source file: LogProviderImpl.java

  18 
vote

/** 
 * @see LogProviderManagementMBean#getLogLevel(java.lang.String)
 */
public String getLogLevel(String component){
  Logger log=logMap.get(component);
  if (log == null) {
    throw new IllegalArgumentException("No Log for component " + component);
  }
  org.apache.log4j.Logger logger=((org.apache.log4j.Logger)log).getRootLogger();
  if (logger == null || logger.getLevel() == null) {
    return null;
  }
  Level level=logger.getLevel();
  return level.toString();
}
 

Example 11

From project james-imap, under directory /message/src/main/java/org/apache/james/imap/encode/base/.

Source file: EndImapEncoder.java

  18 
vote

/** 
 * @see org.apache.james.imap.encode.ImapEncoder#encode(org.apache.james.imap.api.ImapMessage,org.apache.james.imap.encode.ImapResponseComposer,org.apache.james.imap.api.process.ImapSession)
 */
public void encode(ImapMessage message,ImapResponseComposer composer,ImapSession session) throws IOException {
  final Logger logger=session.getLog();
  if (logger.isWarnEnabled()) {
    logger.warn("Unknown message " + message);
  }
  if (logger.isDebugEnabled()) {
    logger.debug("Chain end reached for " + message);
  }
  composer.untaggedNoResponse("Unknown message in pipeline",null);
}
 

Example 12

From project jeppetto, under directory /jeppetto-dao-mongo/src/main/java/org/iternine/jeppetto/dao/mongodb/.

Source file: MongoDBSessionAspect.java

  18 
vote

public Object manageMongoDBSession(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
  try {
    Logger logger=LoggerFactory.getLogger(proceedingJoinPoint.getSourceLocation().getWithinType());
    MongoDBSession.create(logger,proceedingJoinPoint.getSignature().toShortString());
    Object result=proceedingJoinPoint.proceed();
    MongoDBSession.flush();
    return result;
  }
  finally {
    MongoDBSession.remove();
  }
}
 

Example 13

From project karaf, under directory /client/src/main/java/org/slf4j/impl/.

Source file: SimpleLoggerFactory.java

  18 
vote

/** 
 * Return an appropriate  {@link SimpleLogger} instance by name.
 */
public Logger getLogger(String name){
  Logger slogger=null;
synchronized (this) {
    slogger=(Logger)loggerMap.get(name);
    if (slogger == null) {
      slogger=new SimpleLogger(name);
      loggerMap.put(name,slogger);
    }
  }
  return slogger;
}
 

Example 14

From project kernel_1, under directory /exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/.

Source file: SLF4JExoLogFactory.java

  18 
vote

/** 
 * {@inheritDoc}
 */
@Override protected Log getLogger(final String name){
  Logger slf4jlogger=SecurityHelper.doPrivilegedAction(new PrivilegedAction<Logger>(){
    public Logger run(){
      return LoggerFactory.getLogger(name);
    }
  }
);
  if (slf4jlogger instanceof LocationAwareLogger) {
    return new LocationAwareSLF4JExoLog((LocationAwareLogger)slf4jlogger);
  }
 else {
    return new SLF4JExoLog(slf4jlogger);
  }
}
 

Example 15

From project lilith, under directory /lilith/src/main/java/de/huxhorn/lilith/.

Source file: Lilith.java

  18 
vote

private static void flushLicensed(){
  final Logger logger=LoggerFactory.getLogger(Lilith.class);
  ApplicationPreferences prefs=new ApplicationPreferences();
  prefs.setLicensed(false);
  if (logger.isInfoEnabled())   logger.info("Flushed licensed...");
  System.exit(0);
}
 

Example 16

From project ATHENA, under directory /core/apa/src/main/java/org/fracturedatlas/athena/apa/impl/jpa/.

Source file: TicketProp.java

  17 
vote

/** 
 * A convenience method for calling compareTo.  It wall also conveniently eat any ClassCastExceptions or IllegalArgumentExceptions that arise from the caller sending in uncastable data (which is, unfortunately, a probable scenario)
 */
public Boolean valueEquals(Object o){
  Boolean isSame=Boolean.FALSE;
  try {
    isSame=compareTo(o) == 0;
  }
 catch (  ClassCastException e) {
    Logger logger=LoggerFactory.getLogger(this.getClass().getName());
    logger.error(e.getMessage(),e);
  }
catch (  IllegalArgumentException e) {
    Logger logger=LoggerFactory.getLogger(this.getClass().getName());
    logger.error(e.getMessage(),e);
  }
  return isSame;
}
 

Example 17

From project cas, under directory /cas-server-core/src/main/java/org/jasig/cas/aspect/.

Source file: LogAspect.java

  17 
vote

@Around("(execution (public * org.jasig.cas..*.*(..))) && !(execution( * org.jasig.cas..*.set*(..)))") public Object traceMethod(final ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
  Object returnVal=null;
  final Logger log=getLog(proceedingJoinPoint);
  final String methodName=proceedingJoinPoint.getSignature().getName();
  try {
    if (log.isTraceEnabled()) {
      final Object[] args=proceedingJoinPoint.getArgs();
      final String arguments;
      if (args == null || args.length == 0) {
        arguments="";
      }
 else {
        arguments=Arrays.deepToString(args);
      }
      log.trace("Entering method [" + methodName + " with arguments ["+ arguments+ "]");
    }
    returnVal=proceedingJoinPoint.proceed();
    return returnVal;
  }
  finally {
    if (log.isTraceEnabled()) {
      log.trace("Leaving method [" + methodName + "] with return value ["+ (returnVal != null ? returnVal.toString() : "null")+ "].");
    }
  }
}
 

Example 18

From project GNDMS, under directory /infra/test-src/de/zib/gndms/infra/configlet/.

Source file: C3MDSConfigletSoloTest.java

  17 
vote

@Test public void testC3MDS(){
  Logger log=LoggerFactory.getLogger("test");
  HashMap<String,String> configMap=Maps.newHashMap();
  configMap.put("delay","10000");
  configMap.put("initialDelay","1000");
  configMap.put("mdsUrl","http://c3grid-gt.e-technik.uni-dortmund.de:8080/webmds/webmds?info=indexinfo");
  C3MDSConfiglet configlet=new C3MDSConfiglet();
  configlet.init(log,"c3mds",configMap);
  try {
    Thread.sleep(23000L);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  configlet.shutdown();
}
 

Example 19

From project gwt-support, under directory /hudson-gwt-slf4j/src/main/java/org/slf4j/impl/.

Source file: JDK14LoggerFactory.java

  17 
vote

public synchronized Logger getLogger(String name){
  Logger ulogger=null;
synchronized (this) {
    if (name.equalsIgnoreCase(Logger.ROOT_LOGGER_NAME)) {
      name="";
    }
    ulogger=(Logger)loggerMap.get(name);
    if (ulogger == null) {
      java.util.logging.Logger logger=java.util.logging.Logger.getLogger(name);
      ulogger=new JDK14LoggerAdapter(logger);
      loggerMap.put(name,ulogger);
    }
  }
  return ulogger;
}
 

Example 20

From project james-mailbox, under directory /store/src/main/java/org/apache/james/mailbox/store/search/.

Source file: MessageSearcher.java

  17 
vote

/** 
 * Is  {@link #getSearchContent()} found in the given input?
 * @param input <code>InputStream</code> containing an email
 * @return true if the content exists and the stream contains the content,false otherwise
 * @throws IOException
 * @throws MimeException
 */
public boolean isFoundIn(final InputStream input) throws IOException, MimeException {
  final boolean includeHeaders;
  final CharSequence searchContent;
  final boolean isCaseInsensitive;
synchronized (this) {
    includeHeaders=this.includeHeaders;
    searchContent=this.searchContent;
    isCaseInsensitive=this.isCaseInsensitive;
  }
  final boolean result;
  if (searchContent == null || "".equals(searchContent)) {
    final Logger logger=getLogger();
    logger.debug("Nothing to search for. ");
    result=false;
  }
 else {
    final CharBuffer buffer=createBuffer(searchContent,isCaseInsensitive);
    result=parse(input,isCaseInsensitive,includeHeaders,buffer);
  }
  return result;
}
 

Example 21

From project jnrpe-server, under directory /jnrpe-server/src/main/java/it/jnrpe/server/.

Source file: EventLoggerListener.java

  17 
vote

public void receive(Object sender,IJNRPEEvent event){
  String sClassName=sender.getClass().getName();
  Logger logger=m_mLoggers.get(sClassName);
  if (logger == null) {
    logger=LoggerFactory.getLogger(sender.getClass());
    m_mLoggers.put(sClassName,logger);
  }
  Throwable error=(Throwable)event.getEventParams().get("EXCEPTION");
  String sEventName=event.getEventName();
  if (sEventName.equals("TRACE")) {
    if (error != null)     logger.trace((String)event.getEventParams().get("MESSAGE"),error);
 else     logger.trace((String)event.getEventParams().get("MESSAGE"));
    return;
  }
  if (sEventName.equals("DEBUG")) {
    if (error != null)     logger.debug((String)event.getEventParams().get("MESSAGE"),error);
 else     logger.debug((String)event.getEventParams().get("MESSAGE"));
    return;
  }
  if (sEventName.equals("INFO")) {
    if (error != null)     logger.info((String)event.getEventParams().get("MESSAGE"),error);
 else     logger.info((String)event.getEventParams().get("MESSAGE"));
    return;
  }
  if (sEventName.equals("WARNING")) {
    if (error != null)     logger.warn((String)event.getEventParams().get("MESSAGE"),error);
 else     logger.warn((String)event.getEventParams().get("MESSAGE"));
    return;
  }
  if (sEventName.equals("ERROR")) {
    if (error != null)     logger.error((String)event.getEventParams().get("MESSAGE"),error);
 else     logger.error((String)event.getEventParams().get("MESSAGE"));
    return;
  }
  if (sEventName.equals("FATAL")) {
    if (error != null)     logger.error((String)event.getEventParams().get("MESSAGE"),(Throwable)(event.getEventParams().get("EXCEPTION")));
 else     logger.error((String)event.getEventParams().get("MESSAGE"));
    return;
  }
}
 

Example 22

From project JsTestDriver, under directory /JsTestDriver/src/com/google/jstestdriver/server/handlers/.

Source file: BrowserLoggingHandler.java

  17 
vote

public void handleIt() throws IOException {
  try {
    Collection<BrowserLog> logs=gson.fromJson(request.getParameter("logs"),new TypeToken<Collection<BrowserLog>>(){
    }
.getType());
    for (    BrowserLog log : logs) {
      Logger logger=LoggerFactory.getLogger(log.getSource());
switch (log.getLevel()) {
case 1:
        logger.trace(log.getMessage());
      break;
case 2:
    logger.debug(log.getMessage());
  break;
case 3:
logger.info(log.getMessage());
break;
case 4:
logger.warn(log.getMessage());
break;
case 5:
logger.error(log.getMessage());
break;
default :
throw new RuntimeException("Unknown logging level:" + log.getLevel());
}
}
response.setStatus(HttpStatus.ORDINAL_200_OK);
}
 catch (RuntimeException e) {
response.setStatus(HttpStatus.ORDINAL_500_Internal_Server_Error);
logger.error("Error during BrowserLog write.",e);
}
 finally {
response.getOutputStream().flush();
}
}
 

Example 23

From project ACLS-protocol-library, under directory /aclslib/src/main/java/au/edu/uq/cmm/aclslib/server/.

Source file: RequestProcessorBase.java

  15 
vote

public RequestProcessorBase(ACLSProxyConfiguration config,FacilityMapper facilityMapper,Logger logger,Socket socket){
  super();
  this.socket=socket;
  this.config=config;
  this.facilityMapper=facilityMapper;
  this.logger=logger;
  this.trustedAddresses=config.getTrustedInetAddresses();
  this.allowUnknownClients=config.isAllowUnknownClients();
}
 

Example 24

From project activejdbc, under directory /activejdbc/src/main/java/org/javalite/activejdbc/.

Source file: LogFilter.java

  15 
vote

static void logQuery(Logger logger,String query,Object[] params,long queryStartTime){
  long time=System.currentTimeMillis() - queryStartTime;
  if (Registry.instance().getConfiguration().collectStatistics()) {
    Registry.instance().getStatisticsQueue().enqueue(new QueryExecutionEvent(query,time));
  }
  StringBuffer log=new StringBuffer("Query: \"").append(query).append("\"");
  if (params != null && params.length != 0)   log.append(", with parameters: ").append("<").append(Util.join(Arrays.asList(params),">, <")).append(">");
  log(logger,log.append(", took: ").append(time).append(" milliseconds").toString());
}
 

Example 25

From project ANNIS, under directory /annis-interfaces/src/main/java/annis/model/.

Source file: DataObject.java

  15 
vote

private void forEachFieldDo(FieldCallBack fieldCallBack){
  Class<?> clazz=this.getClass();
  while (true) {
    Field[] fields=clazz.getDeclaredFields();
    try {
      for (      Field field : fields) {
        if (field.getType() == Logger.class)         continue;
        if (field.getAnnotation(Transient.class) != null)         continue;
        if ("serialVersionUID".equals(field.getName()))         continue;
        field.setAccessible(true);
        fieldCallBack.doForField(field);
      }
    }
 catch (    IllegalArgumentException e) {
      throw new RuntimeException(e);
    }
catch (    IllegalAccessException e) {
      throw new RuntimeException(e);
    }
    if (clazz.getName().equals(DataObject.class.getName()))     break;
    clazz=clazz.getSuperclass();
  }
}
 

Example 26

From project asterisk-java, under directory /src/main/java/org/asteriskjava/util/internal/.

Source file: Slf4JLogger.java

  15 
vote

/** 
 * Return the native Logger instance we are using.
 */
public final Logger getLogger(){
  if (logger == null) {
    logger=LoggerFactory.getLogger(clazz);
  }
  return (this.logger);
}
 

Example 27

From project camelpe, under directory /examples/loan-broker-common/src/test/java/net/camelpe/examples/loanbroker/queue/test/.

Source file: JmsBroker.java

  15 
vote

private void startHornetQServer() throws Exception {
  this.log.info("Starting embedded HornetQ server ...");
  org.hornetq.core.logging.Logger.setDelegateFactory(new Log4jLogDelegateFactory());
  final Configuration configuration=configureCore();
  final JMSConfiguration jmsConfig=configureJms();
  configureQueues(jmsConfig);
  this.jmsServer=new EmbeddedJMS();
  this.jmsServer.setConfiguration(configuration);
  this.jmsServer.setJmsConfiguration(jmsConfig);
  this.jmsServer.start();
  this.log.info("Embedded HornetQ server [{}] started",this.jmsServer);
}
 

Example 28

From project cascading, under directory /src/core/cascading/util/.

Source file: Util.java

  15 
vote

public static <T>T retry(Logger logger,int retries,int secondsDelay,String message,RetryOperator<T> operator) throws Exception {
  Exception saved=null;
  for (int i=0; i < retries; i++) {
    try {
      return operator.operate();
    }
 catch (    Exception exception) {
      if (operator.rethrow(exception)) {
        logger.warn(message + ", but not retrying",exception);
        throw exception;
      }
      saved=exception;
      logger.warn(message + ", attempt: " + (i + 1),exception);
      try {
        Thread.sleep(secondsDelay * 1000);
      }
 catch (      InterruptedException exception1) {
      }
    }
  }
  logger.warn(message + ", done retrying after attempts: " + retries,saved);
  throw saved;
}
 

Example 29

From project cdi-extension-showcase, under directory /src/main/java/com/acme/logging/.

Source file: LoggerProducer.java

  15 
vote

@Produces @Category public Logger produceLog(InjectionPoint injectionPoint){
  String category=null;
  category=injectionPoint.getAnnotated().getAnnotation(Category.class).value();
  if (category.isEmpty()) {
    category=injectionPoint.getMember().getDeclaringClass().getName();
  }
  return LoggerFactory.getLogger(category);
}
 

Example 30

From project clustermeister, under directory /node-common/src/main/java/com/github/nethad/clustermeister/node/common/.

Source file: MBeanUtils.java

  15 
vote

/** 
 * Utility method to invoke methods on MBeans. Exceptions are logged to the supplies logger.
 * @param logger        the logger to use to log exceptions.
 * @param mbeanServer   the mbean server.
 * @param mbeanName     the name of the meban to invoke a method on.
 * @param methodName    the name of the method to invoke.
 * @param arguments     method arguments. Signature is generated based on runtime type of arguments.
 * @return the object returned by the method invocation or null.
 */
public static Object invoke(Logger logger,MBeanServer mbeanServer,ObjectName mbeanName,String methodName,Object... arguments){
  try {
    String[] signature;
    if (arguments != null) {
      signature=new String[arguments.length];
      for (int i=0; i < arguments.length; ++i) {
        signature[i]=arguments[i].getClass().getCanonicalName();
      }
    }
 else {
      signature=null;
    }
    return mbeanServer.invoke(mbeanName,methodName,arguments,signature);
  }
 catch (  InstanceNotFoundException ex) {
    logger.warn("No such MBean instance found.",ex);
  }
catch (  MBeanException ex) {
    logger.warn("MBean raised exception during method invokation.",ex);
  }
catch (  ReflectionException ex) {
    logger.warn("Method not found.",ex);
  }
  return null;
}
 

Example 31

From project elw, under directory /common/src/main/java/base/pattern/.

Source file: Result.java

  15 
vote

public static void success(@Nullable final Logger log,Result[] resultRef,final String message){
  if (log != null) {
    log.info(message);
  }
  success(resultRef,message);
}
 

Example 32

From project exanpe-t5-lib, under directory /src/main/java/fr/exanpe/t5/lib/internal/authorize/.

Source file: AuthorizePageFilter.java

  15 
vote

public AuthorizePageFilter(AuthorizeBusinessService abs,RequestGlobals request,ComponentSource componentSource,Logger logger){
  this.authorizeBusinessService=abs;
  this.requestGlobals=request;
  this.componentSource=componentSource;
  this.logger=logger;
}
 

Example 33

From project floodlight, under directory /src/main/java/net/floodlightcontroller/staticflowentry/.

Source file: StaticFlowEntries.java

  15 
vote

@LogMessageDoc(level="ERROR",message="Invalid subaction: '{subaction}'",explanation="A static flow entry contained an invalid subaction",recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG) private static SubActionStruct decode_output(String subaction,Logger log){
  SubActionStruct sa=null;
  Matcher n;
  n=Pattern.compile("output=(?:((?:0x)?\\d+)|(all)|(controller)|(local)|(ingress-port)|(normal)|(flood))").matcher(subaction);
  if (n.matches()) {
    OFActionOutput action=new OFActionOutput();
    action.setMaxLength((short)Short.MAX_VALUE);
    short port=OFPort.OFPP_NONE.getValue();
    if (n.group(1) != null) {
      try {
        port=get_short(n.group(1));
      }
 catch (      NumberFormatException e) {
        log.debug("Invalid port in: '{}' (error ignored)",subaction);
        return null;
      }
    }
 else     if (n.group(2) != null)     port=OFPort.OFPP_ALL.getValue();
 else     if (n.group(3) != null)     port=OFPort.OFPP_CONTROLLER.getValue();
 else     if (n.group(4) != null)     port=OFPort.OFPP_LOCAL.getValue();
 else     if (n.group(5) != null)     port=OFPort.OFPP_IN_PORT.getValue();
 else     if (n.group(6) != null)     port=OFPort.OFPP_NORMAL.getValue();
 else     if (n.group(7) != null)     port=OFPort.OFPP_FLOOD.getValue();
    action.setPort(port);
    log.debug("action {}",action);
    sa=new SubActionStruct();
    sa.action=action;
    sa.len=OFActionOutput.MINIMUM_LENGTH;
  }
 else {
    log.error("Invalid subaction: '{}'",subaction);
    return null;
  }
  return sa;
}
 

Example 34

From project Flume-Hive, under directory /src/java/com/cloudera/flume/agent/.

Source file: FlumeNode.java

  15 
vote

public static void logEnvironment(Logger log){
  Properties props=System.getProperties();
  for (  Entry<Object,Object> p : props.entrySet()) {
    log.info("System property " + p.getKey() + "="+ p.getValue());
  }
}
 

Example 35

From project flume_1, under directory /flume-core/src/main/java/com/cloudera/flume/agent/.

Source file: FlumeNode.java

  15 
vote

public static void logEnvironment(Logger log){
  Properties props=System.getProperties();
  for (  Entry<Object,Object> p : props.entrySet()) {
    log.info("System property " + p.getKey() + "="+ p.getValue());
  }
}
 

Example 36

From project galaxy, under directory /src/co/paralleluniverse/galaxy/netty/.

Source file: TcpMessagePipelineFactory.java

  15 
vote

public TcpMessagePipelineFactory(Logger logger,DefaultChannelGroup channelGroup,Executor executor){
  this.logger=logger;
  this.channelGroup=channelGroup;
  this.nodeResolver=new ChannelAttachedNodeResolver();
  this.lengthFieldSize=4;
  this.executor=executor;
}
 

Example 37

From project hadoop-book_1, under directory /src/main/java/com/manning/hip/ch12/crunch/.

Source file: CrunchUtils.java

  15 
vote

public static PCollection<CommonLogEntry> logs(PCollection<String> lines){
  PTypeFamily tf=lines.getTypeFamily();
  return lines.parallelDo(new DoFn<String,CommonLogEntry>(){
    transient ApacheCommonLogReader logReader;
    transient Logger log;
    @Override public void initialize(){
      logReader=new ApacheCommonLogReader();
      log=LoggerFactory.getLogger(CrunchUtils.class);
    }
    @Override public void process(    String input,    Emitter<CommonLogEntry> emitter){
      try {
        CommonLogEntry log=logReader.decodeLine(input);
        if (log != null) {
          emitter.emit(log);
        }
 else {
          processingError(input,null);
        }
      }
 catch (      IOException e) {
        processingError(input,e);
      }
    }
    void processingError(    String line,    @Nullable Throwable t){
      super.getCounter(LogCounters.LOG_LINE_ERRORS).increment(1);
      log.error("Hit exception parsing line '" + line + "'",t);
    }
  }
,tf.records(CommonLogEntry.class));
}
 

Example 38

From project Hesperid, under directory /server/src/main/java/ch/astina/hesperid/web/services/.

Source file: AppModule.java

  15 
vote

@Startup public static void initHesperid(SystemEnvironment systemEnvironment,Logger logger){
  logger.info("Starting Hesperid with home directory: " + systemEnvironment.getApplicationHomeDirectoryPath());
  try {
    org.apache.log4j.Logger root=org.apache.log4j.Logger.getRootLogger();
    Layout fileAppenderLayout=new PatternLayout("%d %p (%t) [%c{2}] - %m%n");
    RollingFileAppender rfa=new RollingFileAppender();
    rfa.setMaxFileSize("10240KB");
    rfa.setMaxBackupIndex(10);
    rfa.setLayout(fileAppenderLayout);
    rfa.setFile(systemEnvironment.getApplicationLogfilePath());
    rfa.setName("file");
    rfa.activateOptions();
    root.addAppender(rfa);
  }
 catch (  Exception e) {
    logger.error("Cannot add file appender for logging",e);
  }
}
 

Example 39

From project HippoCocoonToolkit, under directory /editor/frontend/src/main/java/net/tirasa/hct/editor/panel/.

Source file: ViewComponentPanel.java

  15 
vote

private void updatePageProperty(final String component,final String siteName){
  try {
    final PageDataProvider dataProvider=new PageDataProvider(siteName);
    dataProvider.size();
    final List l=dataProvider.getPageList();
    final Iterator iter=l.iterator();
    while (iter.hasNext()) {
      final PageBean page=(PageBean)iter.next();
      page.setPageProperties();
      page.removeComponent(component);
      page.save();
    }
  }
 catch (  RepositoryException ex) {
    java.util.logging.Logger.getLogger(ViewComponentPanel.class.getName()).log(Level.SEVERE,null,ex);
  }
}
 

Example 40

From project hoop, under directory /hoop-server/src/test/java/com/cloudera/lib/lang/.

Source file: TestClassUtils.java

  15 
vote

@Test @TestDir public void getJar() throws Exception {
  String jar=ClassUtils.getJar(Logger.class);
  Assert.assertNotNull(jar);
  Assert.assertTrue(jar.contains("slf4j-api"));
  jar=ClassUtils.getJar(String.class);
  Assert.assertNull(jar);
}
 

Example 41

From project incubator-s4, under directory /subprojects/s4-core/src/main/java/org/apache/s4/core/.

Source file: Server.java

  15 
vote

public void start(Injector injector) throws Exception {
  this.injector=injector;
  ch.qos.logback.classic.Logger root=(ch.qos.logback.classic.Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
  root.setLevel(Level.toLevel(logLevel));
  if (deploymentManager != null) {
    deploymentManager.start();
  }
  signalOneAppLoaded.await();
}
 

Example 42

From project javamagic, under directory /cometd/src/main/java/com/googlecode/tawus/cometd/internal/.

Source file: BayeuxServerSourceImpl.java

  15 
vote

public BayeuxServerSourceImpl(List<BayeuxServerConfigurer> configurers,ObjectLocator locator,Logger logger){
  bayeux=newBayeuxServer();
  this.locator=locator;
  this.configurers=configurers;
  this.logger=logger;
  annotationServices=new ArrayList<Object>();
  allowedTransports=new ArrayList<HttpTransport>();
  initialized=false;
}
 

Example 43

From project jdeltasync, under directory /src/main/java/com/googlecode/jdeltasync/.

Source file: DeltaSyncSession.java

  15 
vote

/** 
 * Returns the  {@link Logger} which will be used by {@link DeltaSyncClient}to log things for this session.
 * @return the {@link Logger}.
 */
public Logger getLogger(){
  if (logger == null) {
    logger=LoggerFactory.getLogger(DeltaSyncSession.class.getName() + "." + username);
  }
  return logger;
}
 

Example 44

From project jena-tdb, under directory /src/main/java/com/hp/hpl/jena/tdb/base/block/.

Source file: BlockMgrLogger.java

  15 
vote

public BlockMgrLogger(Logger log,String label,BlockMgr blockMgr,boolean logAllOperations){
  this.blockMgr=blockMgr;
  if (log == null)   log=LoggerFactory.getLogger(BlockMgr.class);
  this.log=log;
  this.logAllOperations=logAllOperations;
  this.label=label;
}
 

Example 45

From project leviathan, under directory /common/src/main/java/ar/com/zauber/leviathan/common/async/.

Source file: ThreadUtils.java

  15 
vote

/** 
 * espera que termine un thread 
 */
public static boolean waitForTermination(final Thread thread,final Logger logger){
  boolean wait=true;
  while (wait && thread.isAlive()) {
    try {
      thread.join();
      wait=false;
    }
 catch (    InterruptedException e) {
      if (logger != null) {
        logger.warn("interrupted while shutting down");
      }
      try {
        Thread.sleep(200);
      }
 catch (      InterruptedException e1) {
      }
    }
  }
  return wait;
}