org.restlet.Context.getCurrentLogger()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.restlet.Context.getCurrentLogger()方法的一些代码示例,展示了Context.getCurrentLogger()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.getCurrentLogger()方法的具体详情如下:
包路径:org.restlet.Context
类名称:Context
方法名:getCurrentLogger

Context.getCurrentLogger介绍

[英]Returns the current context's logger.
[中]返回当前上下文的记录器。

代码示例

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Callback invoked when an IO exception occurs. By default, it logs the
 * exception at the {@link Level#WARNING} level.
 * 
 * @param ioe
 *            The exception caught.
 */
protected void onError(IOException ioe) {
  Context.getCurrentLogger().log(Level.WARNING, "", ioe);
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Callback invoked when an IO exception occurs. By default, it logs the
 * exception at the {@link Level#WARNING} level.
 * 
 * @param ioe
 *            The exception caught.
 */
protected void onError(IOException ioe) {
  Context.getCurrentLogger().log(Level.WARNING, "", ioe);
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Resume interest in new listener notifications. This should be called
 * after a {@link #suspend()} call.
 */
public void resume() {
  if (Context.getCurrentLogger().isLoggable(Level.FINER)) {
    Context.getCurrentLogger().log(Level.FINER,
        "Resuming previous NIO interest");
  }
  setInterestOperations(this.previousInterest);
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Resume interest in new listener notifications. This should be called
 * after a {@link #suspend()} call.
 */
public void resume() {
  if (Context.getCurrentLogger().isLoggable(Level.FINER)) {
    Context.getCurrentLogger().log(Level.FINER,
        "Resuming previous NIO interest");
  }
  setInterestOperations(this.previousInterest);
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Creates a new entry.
 * 
 * @param name
 *            The name of the entry.
 * @param value
 *            The value of the entry.
 * @return A new entry.
 */
public T createEntry(String name, String value) {
  try {
    return this.entryClass.getConstructor(String.class, String.class)
        .newInstance(name, value);
  } catch (Exception e) {
    Context.getCurrentLogger().log(Level.WARNING,
        "Unable to create a series entry", e);
    return null;
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet

public void run() {
    try {
      representation.write(os);
      os.flush();
    } catch (IOException ioe) {
      Context.getCurrentLogger().log(Level.WARNING,
          "Error while writing to the piped input stream.",
          ioe);
    } finally {
      try {
        os.close();
      } catch (IOException ioe2) {
        Context.getCurrentLogger().log(Level.WARNING,
            "Error while closing the pipe.", ioe2);
      }
    }
  }
};

代码示例来源:origin: org.restlet/org.restlet.ext.xml

/**
 * Set a schema representation to be compiled and used when parsing and
 * validating this type of XML representations.
 * 
 * @param schemaRepresentation
 *            The schema representation to set.
 */
public void setSchema(Representation schemaRepresentation) {
  try {
    this.schema = getSchema(schemaRepresentation);
  } catch (Exception e) {
    Context.getCurrentLogger().log(Level.WARNING,
        "Unable to compile the schema representation", e);
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Closes and releases the input stream.
 */
@Override
public void release() {
  if (this.reader != null) {
    try {
      this.reader.close();
    } catch (IOException e) {
      Context.getCurrentLogger().log(Level.WARNING,
          "Error while releasing the representation.", e);
    }
    this.reader = null;
  }
  super.release();
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.xml

/**
 * Set a schema representation to be compiled and used when parsing and
 * validating this type of XML representations.
 * 
 * @param schemaRepresentation
 *            The schema representation to set.
 */
public void setSchema(Representation schemaRepresentation) {
  try {
    this.schema = getSchema(schemaRepresentation);
  } catch (Exception e) {
    Context.getCurrentLogger().log(Level.WARNING,
        "Unable to compile the schema representation", e);
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet

public void onSelected(
      SelectionRegistration registration)
      throws IOException {
    if (Context.getCurrentLogger()
        .isLoggable(Level.FINER)) {
      Context.getCurrentLogger()
          .log(Level.FINER,
              "NbChannelInputStream selected");
    }
    // Stop listening at this point
    selectionRegistration.suspend();
    // Unblock the user thread
    selectionRegistration.unblock();
  }
});

代码示例来源:origin: org.restlet/org.restlet

/**
 * Closes and releases the input stream.
 */
@Override
public void release() {
  if (this.reader != null) {
    try {
      this.reader.close();
    } catch (IOException e) {
      Context.getCurrentLogger().log(Level.WARNING,
          "Error while releasing the representation.", e);
    }
    this.reader = null;
  }
  super.release();
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Closes and releases the input stream.
 */
@Override
public void release() {
  if (this.stream != null) {
    try {
      this.stream.close();
    } catch (IOException e) {
      Context.getCurrentLogger().log(Level.WARNING,
          "Error while releasing the representation.", e);
    }
    this.stream = null;
  }
  super.release();
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Closes and releases the input stream.
 */
@Override
public void release() {
  if (this.stream != null) {
    try {
      this.stream.close();
    } catch (IOException e) {
      Context.getCurrentLogger().log(Level.WARNING,
          "Error while releasing the representation.", e);
    }
    this.stream = null;
  }
  super.release();
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Closes and releases the readable channel.
 */
@Override
public void release() {
  if (this.channel != null) {
    try {
      this.channel.close();
    } catch (IOException e) {
      Context.getCurrentLogger().log(Level.WARNING,
          "Error while releasing the representation.", e);
    }
    this.channel = null;
  }
  super.release();
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Closes and releases the input stream.
 */
@Override
public void release() {
  if (this.stream != null) {
    try {
      this.stream.close();
    } catch (IOException e) {
      Context.getCurrentLogger().log(Level.WARNING,
          "Error while releasing the representation.", e);
    }
    this.stream = null;
  }
  super.release();
}

代码示例来源:origin: org.restlet/org.restlet

public void run() {
    try {
      final OutputStream os = pipe.getOutputStream();
      representation.write(os);
      os.write(-1);
      os.close();
    } catch (IOException ioe) {
      Context.getCurrentLogger().log(Level.FINE,
          "Error while writing to the piped input stream.",
          ioe);
    }
  }
});

代码示例来源:origin: org.restlet.osgi/org.restlet

@Override
public void error(SAXParseException x) throws SAXException {
  if (loggable) {
    final String msg = "[ERROR] - Unexpected exception while parsing "
        + "an instance of PUBLIC [" + x.getPublicId()
        + "], SYSTEM [" + x.getSystemId() + "] - line #"
        + x.getLineNumber() + ", column #" + x.getColumnNumber();
    if (debug) {
      Context.getCurrentLogger().log(Level.CONFIG, msg, x);
    } else {
      logger.config(msg + ": " + x.getLocalizedMessage());
    }
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet

@Override
public void fatalError(SAXParseException x) throws SAXException {
  if (loggable) {
    final String msg = "[FATAL] - Unexpected exception while parsing "
        + "an instance of PUBLIC [" + x.getPublicId()
        + "], SYSTEM [" + x.getSystemId() + "] - line #"
        + x.getLineNumber() + ", column #" + x.getColumnNumber();
    if (debug) {
      Context.getCurrentLogger().log(Level.CONFIG, msg, x);
    } else {
      logger.config(msg + ": " + x.getLocalizedMessage());
    }
  }
}

代码示例来源:origin: org.restlet/org.restlet

public void run() {
    try {
      final WritableByteChannel wbc = pipe.sink();
      representation.write(wbc);
      wbc.close();
    } catch (IOException ioe) {
      Context.getCurrentLogger().log(Level.FINE,
          "Error while writing to the piped channel.", ioe);
    }
  }
});

代码示例来源:origin: org.restlet.osgi/org.restlet

@Override
  public void warning(SAXParseException x) throws SAXException {
    if (loggable) {
      final String msg = "[WARN] - Unexpected exception while parsing "
          + "an instance of PUBLIC [" + x.getPublicId()
          + "], SYSTEM [" + x.getSystemId() + "] - line #"
          + x.getLineNumber() + ", column #" + x.getColumnNumber();
      if (debug) {
        Context.getCurrentLogger().log(Level.CONFIG, msg, x);
      } else {
        logger.config(msg + ": " + x.getLocalizedMessage());
      }
    }
  }
}

相关文章