org.modeshape.jcr.api.Logger.error()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(246)

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

Logger.error介绍

[英]Log a message at the ERROR level according to the specified format and (optional) parameters. The message should contain a pair of empty curly braces for each of the parameter, which should be passed in the correct order. The pattern consists of zero or more keys of the form {n}, where n is an integer starting at 0. Therefore, the first parameter replaces all occurrences of "{0}", the second parameter replaces all occurrences of "{1}", etc.

If any parameter is null, the corresponding key is replaced with the string "null". Therefore, consider using an empty string when keys are to be removed altogether.
[中]根据指定的格式和(可选)参数以错误级别记录消息。消息应该为每个参数包含一对空大括号,并且应该按照正确的顺序传递。该模式由格式为{n}的零个或多个键组成,其中n是从0开始的整数。因此,第一个参数替换所有出现的“{0}”,第二个参数替换所有出现的“{1}”,等等。
如果任何参数为null,则相应的键将替换为字符串“null”。因此,当键被完全移除时,考虑使用一个空字符串。

代码示例

代码示例来源:origin: ModeShape/modeshape

  1. /**
  2. * Returns a set with all the names of the available repositories.
  3. * @return a set with the names, never {@code null}
  4. */
  5. public static Set<String> getJcrRepositoryNames() {
  6. try {
  7. return repositoriesContainer.getRepositoryNames(Collections.unmodifiableMap(factoryParams));
  8. } catch (RepositoryException e) {
  9. LOGGER.error(e, WebJcrI18n.cannotLoadRepositoryNames.text());
  10. return Collections.emptySet();
  11. }
  12. }

代码示例来源:origin: org.modeshape/modeshape-web-jcr

  1. /**
  2. * Returns a set with all the names of the available repositories.
  3. * @return a set with the names, never {@code null}
  4. */
  5. public static Set<String> getJcrRepositoryNames() {
  6. try {
  7. return repositoriesContainer.getRepositoryNames(Collections.unmodifiableMap(factoryParams));
  8. } catch (RepositoryException e) {
  9. LOGGER.error(e, WebJcrI18n.cannotLoadRepositoryNames.text());
  10. return Collections.emptySet();
  11. }
  12. }

代码示例来源:origin: ModeShape/modeshape

  1. private Response exceptionResponse( Throwable t,
  2. Status status ) {
  3. switch (status) {
  4. case NOT_FOUND: {
  5. LOGGER.debug(t, "Item not found");
  6. break;
  7. }
  8. default: {
  9. LOGGER.error(t, "Server error");
  10. break;
  11. }
  12. }
  13. return Response.status(status).entity(new RestException(t)).build();
  14. }
  15. }

代码示例来源:origin: ModeShape/modeshape

  1. protected String valueToString( String absPropertyPath,
  2. Value value,
  3. String baseUrl,
  4. Session session ) {
  5. if (value == null) {
  6. return null;
  7. }
  8. try {
  9. switch (value.getType()) {
  10. case PropertyType.BINARY: {
  11. assert baseUrl != null;
  12. return restValueForBinary(absPropertyPath, baseUrl);
  13. }
  14. case PropertyType.REFERENCE:
  15. case PropertyType.WEAKREFERENCE:
  16. case org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE: {
  17. assert session != null;
  18. return restValueForReference(value, baseUrl, session);
  19. }
  20. default: {
  21. return value.getString();
  22. }
  23. }
  24. } catch (Exception e) {
  25. logger.error("Cannot create JSON string from value ", e);
  26. return null;
  27. }
  28. }

代码示例来源:origin: ModeShape/modeshape

  1. private void addRepository( HttpServletRequest request,
  2. RestRepositories repositories,
  3. String repositoryName ) {
  4. RestRepositories.Repository repository = repositories.addRepository(repositoryName, request);
  5. try {
  6. Repository jcrRepository = RepositoryManager.getRepository(repositoryName);
  7. repository.setActiveSessionsCount(((org.modeshape.jcr.api.Repository)jcrRepository).getActiveSessionsCount());
  8. for (String metadataKey : jcrRepository.getDescriptorKeys()) {
  9. Value[] descriptorValues = jcrRepository.getDescriptorValues(metadataKey);
  10. if (descriptorValues != null) {
  11. List<String> values = new ArrayList<String>(descriptorValues.length);
  12. for (Value descriptorValue : descriptorValues) {
  13. values.add(descriptorValue.getString());
  14. }
  15. repository.addMetadata(metadataKey, values);
  16. }
  17. }
  18. } catch (Exception e) {
  19. logger.error(e, e.getMessage());
  20. }
  21. }

代码示例来源:origin: ModeShape/modeshape

  1. binaryStream.close();
  2. } catch (IOException e) {
  3. logger.error("Cannot close binary stream", e);

代码示例来源:origin: ModeShape/modeshape

  1. binaryStream.close();
  2. } catch (IOException ioe) {
  3. logger.error("Cannot close binary stream", ioe);

代码示例来源:origin: org.fcrepo/modeshape-jcr

  1. @GuardedBy( "this" )
  2. private void removeProvidedIndex( AtomicIndex index,
  3. ChangeBus observable ) {
  4. try {
  5. observable.unregister(index);
  6. removeIndex(index.indexDefinition(), index.managed(), index.workspaceName());
  7. } catch (RuntimeException e) {
  8. String msg = "Error removing index '{0}' in workspace '{1}' with definition: {2}";
  9. logger().error(e, msg, index.getName(), index.workspaceName(), index.indexDefinition());
  10. }
  11. }

代码示例来源:origin: ModeShape/modeshape

  1. @GuardedBy( "this" )
  2. private void removeProvidedIndex( AtomicIndex index,
  3. ChangeBus observable ) {
  4. try {
  5. observable.unregister(index);
  6. removeIndex(index.indexDefinition(), index.managed(), index.workspaceName());
  7. } catch (RuntimeException e) {
  8. String msg = "Error removing index '{0}' in workspace '{1}' with definition: {2}";
  9. logger().error(e, msg, index.getName(), index.workspaceName(), index.indexDefinition());
  10. }
  11. }

代码示例来源:origin: ModeShape/modeshape

  1. isValid = metadata.check();
  2. } catch (Exception e) {
  3. getLogger().error(e, "Could not sequence audio file with MIMEType {0}", mimeType);
  4. return true;
  5. } else {
  6. getLogger().error("Could not sequence audio file with MIMEType {0}", mimeType);
  7. return false;

代码示例来源:origin: ModeShape/modeshape

  1. private boolean processBasicMetadata( Node sequencedNode,
  2. Binary binaryValue ) {
  3. VideoMetadata metadata = null;
  4. try (InputStream stream = binaryValue.getStream()) {
  5. metadata = new VideoMetadata(stream);
  6. if (metadata.check()) {
  7. setPropertyIfMetadataPresent(sequencedNode, DURATION, metadata.getDuration());
  8. setPropertyIfMetadataPresent(sequencedNode, BITRATE, metadata.getBitrate());
  9. setPropertyIfMetadataPresent(sequencedNode, TITLE, metadata.getTitle());
  10. setPropertyIfMetadataPresent(sequencedNode, COMMENT, metadata.getComment());
  11. setPropertyIfMetadataPresent(sequencedNode, ENCODER, metadata.getEncoder());
  12. int suffix = 0;
  13. for (StreamMetadata streamMetadata : metadata.getStreams()) {
  14. Node streamNode = sequencedNode.addNode(STREAM_NODE + String.valueOf(suffix), STREAM_NODE);
  15. processStreamMetadata(streamNode, streamMetadata);
  16. suffix += 1;
  17. }
  18. return true;
  19. }
  20. } catch (Exception e) {
  21. getLogger().error(e, "Couldn't process the stream.");
  22. }
  23. return false;
  24. }

代码示例来源:origin: org.fcrepo/modeshape-jcr

  1. } catch (RuntimeException e) {
  2. String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
  3. logger().error(e, msg, defn.getName(), workspaceName, defn);
  4. } catch (RuntimeException e) {
  5. String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
  6. logger().error(e, msg, defn.getName(), workspaceName, defn);
  7. } catch (RuntimeException e) {
  8. String msg = "Error adding index '{0}' in workspace '{1}' with definition: {2}";
  9. logger().error(e, msg, defn.getName(), workspaceName, defn);

代码示例来源:origin: ModeShape/modeshape

  1. } catch (RuntimeException e) {
  2. String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
  3. logger().error(e, msg, defn.getName(), workspaceName, defn);
  4. } catch (RuntimeException e) {
  5. String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
  6. logger().error(e, msg, defn.getName(), workspaceName, defn);
  7. } catch (RuntimeException e) {
  8. String msg = "Error adding index '{0}' in workspace '{1}' with definition: {2}";
  9. logger().error(e, msg, defn.getName(), workspaceName, defn);

代码示例来源:origin: ModeShape/modeshape

  1. } catch (RuntimeException e) {
  2. String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
  3. logger().error(e, msg, defn.getName(), workspaceName, defn);

代码示例来源:origin: org.fcrepo/modeshape-jcr

  1. } catch (RuntimeException e) {
  2. String msg = "Error updating index '{0}' in workspace '{1}' with definition: {2}";
  3. logger().error(e, msg, defn.getName(), workspaceName, defn);

代码示例来源:origin: ModeShape/modeshape

  1. private boolean processXMPMetadata( Node sequencedNode,
  2. Binary binaryValue) {
  3. PdfXmpMetadata metadata = null;
  4. try (InputStream stream = binaryValue.getStream()) {
  5. metadata = new PdfXmpMetadata(stream);
  6. if (metadata.check()) {
  7. Node xmpNode = sequencedNode.addNode(PdfMetadataLexicon.XMP_NODE, PdfMetadataLexicon.XMP_NODE);
  8. setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.BASE_URL, metadata.getBaseURL());
  9. setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.CREATE_DATE, metadata.getCreateDate());
  10. setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.CREATOR_TOOL, metadata.getCreatorTool());
  11. setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.IDENTIFIER, metadata.getIdentifier());
  12. setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.METADATA_DATE, metadata.getMetadataDate());
  13. setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.MODIFY_DATE, metadata.getModifyDate());
  14. setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.NICKNAME, metadata.getNickname());
  15. setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.RATING, metadata.getRating());
  16. setPropertyIfMetadataPresent(xmpNode, XmpMetadataLexicon.LABEL, metadata.getLabel());
  17. return true;
  18. }
  19. } catch (Exception e) {
  20. getLogger().error(e, "Couldn't process stream.");
  21. }
  22. return false;
  23. }

代码示例来源:origin: ModeShape/modeshape

  1. private boolean processBasicMetadata( Node sequencedNode,
  2. Binary binaryValue ) {
  3. EpubMetadata metadata = null;
  4. try (InputStream stream = binaryValue.getStream()) {
  5. metadata = new EpubMetadata(stream);
  6. if (metadata.check()) {
  7. addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.TITLE, metadata.getTitle());
  8. addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.CREATOR, metadata.getCreator());
  9. addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.CONTRIBUTOR, metadata.getContributor());
  10. addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.LANGUAGE, metadata.getLanguage());
  11. addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.IDENTIFIER, metadata.getIdentifier());
  12. addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.DESCRIPTION, metadata.getDescription());
  13. addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.PUBLISHER, metadata.getPublisher());
  14. addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.DATE, metadata.getDate());
  15. addEpubMetadataProperties(sequencedNode, EpubMetadataLexicon.RIGHTS, metadata.getRights());
  16. return true;
  17. }
  18. } catch (Exception e) {
  19. getLogger().error(e, "Couldn't process stream.");
  20. }
  21. return false;
  22. }

代码示例来源:origin: ModeShape/modeshape

  1. getLogger().error(e, "Couldn't process stream.");

代码示例来源:origin: ModeShape/modeshape

  1. private boolean processBasicMetadata( Node sequencedNode,
  2. Binary binaryValue ) {
  3. OdfMetadata metadata = null;
  4. try (InputStream stream = binaryValue.getStream()) {
  5. metadata = new OdfMetadata(stream);
  6. if (metadata.check()) {
  7. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.PAGES, metadata.getPages());
  8. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.SHEETS, metadata.getSheets());
  9. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.CREATION_DATE, metadata.getCreationDate());
  10. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.CREATOR, metadata.getCreator());
  11. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.DESCRIPTION, metadata.getDescription());
  12. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.EDITING_CYCLES, metadata.getEditingCycles());
  13. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.EDITING_TIME, metadata.getEditingTime());
  14. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.GENERATOR, metadata.getGenerator());
  15. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.INITIAL_CREATOR, metadata.getInitialCreator());
  16. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.KEYWORDS, metadata.getKeywords());
  17. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.LANGUAGE, metadata.getLanguage());
  18. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.MODIFICATION_DATE, metadata.getModificationDate());
  19. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.PRINTED_BY, metadata.getPrintedBy());
  20. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.PRINT_DATE, metadata.getPrintDate());
  21. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.SUBJECT, metadata.getSubject());
  22. setPropertyIfMetadataPresent(sequencedNode, OdfMetadataLexicon.TITLE, metadata.getTitle());
  23. return true;
  24. }
  25. } catch (Exception e) {
  26. getLogger().error(e, "Couldn't process stream.");
  27. }
  28. return false;
  29. }

相关文章