Skip to content

Commit

Permalink
Merge pull request #242 from eclipse-aas4j/feature/adjust-log-level
Browse files Browse the repository at this point in the history
Cleanup logging & adjust log levels
  • Loading branch information
FrankSchnicke authored Feb 7, 2024
2 parents d1ffc71 + b4f554b commit ac9d9bc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public List<InMemoryFile> getRelatedFiles() throws InvalidFormatException, IOExc
try {
files.add(readFile(aasxRoot, filePath));
} catch (Exception e) {
logger.warn("Loading file " + filePath + " failed and will not be included. Exception: " + e);
logger.warn("Loading file {} failed and will not be included.", filePath, e);
}
}
return files;
Expand Down Expand Up @@ -168,7 +168,7 @@ private PackageRelationshipCollection getXMLDocumentRelation(PackagePart originP

private String getXMLPart(PackagePart originPart) throws InvalidFormatException {
if (isCompatibilityModeNeeded(originPart)) {
logger.warn("AASX contains wrong Relationship namespace. This may be related to the AASX being created with an old version of AASX Package Explorer or an old version of AAS4J. Future compatibility with the wrong namespace may not be guaranteed");
logger.info("AASX contains wrong Relationship namespace. This may be related to the AASX being created with an old version of AASX Package Explorer or an old version of AAS4J. Future compatibility with the wrong namespace may not be guaranteed");
return AASPEC_RELTYPE_BACKWARDSCOMPATIBLE;
} else {
return AASXSerializer.AASSPEC_RELTYPE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ private void createParts(Collection<InMemoryFile> files, String filePath, OPCPac
PackagePart xmlPart, String contentType) {
try {
InMemoryFile content = findFileByPath(files, filePath);
logger.trace("Writing file '" + filePath + "' to .aasx.");
logger.trace("Writing file '{}' to .aasx.", filePath);
createAASXPart(rootPackage, xmlPart, filePath, contentType, AASSUPPL_RELTYPE, content.getFileContent());
} catch (RuntimeException e) {
// Log that a file is missing and continue building the .aasx
logger.warn("Could not add File '" + filePath + "'. It was not contained in given InMemoryFiles.");
logger.warn("Could not add File '{}'. It was not contained in given InMemoryFiles.", filePath, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public static Class<?> getAasInterface(Class<?> type) {
if (implementedAasInterfaces.size() == 1) {
return implementedAasInterfaces.iterator().next();
}
logger.warn("class '{}' implements more than one AAS interface, but only most specific one is returned", type.getName());
logger.debug("class '{}' implements more than one AAS interface, but only most specific one is returned", type.getName());
return implementedAasInterfaces.stream().map(x -> TypeToken.of(x))
.sorted(new MostSpecificTypeTokenComparator())
.findFirst().get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private boolean ignoreDefaults(Node node) {
private void logErrors(String validatedFileName, Set<String> errors) {
if (errors.isEmpty())
return;
logger.info("Validate file: " + validatedFileName);
logger.info("Validate file: {}", validatedFileName);
for (String error : errors) {
logger.info(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void logErrors(String validatedFileName, Set<String> errors) {
if (errors.isEmpty()) {
return;
}
logger.info("Validate file: " + validatedFileName);
logger.info("Validate file: {}", validatedFileName);
for (String error : errors) {
logger.info(error);
}
Expand Down

0 comments on commit ac9d9bc

Please sign in to comment.