Skip to content

Commit

Permalink
Updated logging dep. and cfg., Spring; removed println, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorRodchenkov committed Feb 4, 2024
1 parent 8b91a48 commit ec8a5d6
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 62 deletions.
15 changes: 15 additions & 0 deletions biopax-validator-client/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %-5level [%thread] %logger{25} - %msg%n</pattern>
<outputPatternAsHeader>true</outputPatternAsHeader>
</encoder>
</appender>
<root level="info">
<appender-ref ref="console"/>
</root>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void testClientHtml() throws IOException {
);
// System.out.println(baos);
}

@Test
public void testClientXml() throws IOException, JAXBException {
BiopaxValidatorClient client = new BiopaxValidatorClient();
Expand All @@ -52,13 +52,13 @@ public void testClientXml() throws IOException, JAXBException {
ValidatorResponse resp = client.unmarshal(baos.toString());

Assertions.assertAll(
() -> Assertions.assertTrue(baos.size()>0),
() -> Assertions.assertNotNull(resp),
() -> Assertions.assertEquals(2, resp.getValidation().size())
() -> Assertions.assertTrue(baos.size()>0),
() -> Assertions.assertNotNull(resp),
() -> Assertions.assertEquals(2, resp.getValidation().size())
);
System.out.println(resp.getValidation().get(0).getSummary()
+ "; cases: " + resp.getValidation().get(0).getTotalProblemsFound());
}

// System.out.println(resp.getValidation().get(0).getSummary()
// + "; cases: " + resp.getValidation().get(0).getTotalProblemsFound());
}

}
2 changes: 2 additions & 0 deletions biopax-validator-web/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>
<!-- JMX and additional logback init info -->
<jmxConfigurator/>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %-5level [%thread] %logger{25} - %msg%n</pattern>
Expand Down
4 changes: 2 additions & 2 deletions biopax-validator/src/test/java/LoadTimeWeavingIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public void unknownProperty() { // important!
);
biopaxValidator.validate(validation);
assertEquals(5,validation.getError().size());
validation.getError().stream().forEach(e -> System.out.println(e + ": " + e.getErrorCase().size() + " case(s); "
+ e.getErrorCase().stream().map(ErrorCaseType::toString).collect(Collectors.joining())));
// validation.getError().stream().forEach(e -> System.out.println(e + ": " + e.getErrorCase().size() + " case(s); "
// + e.getErrorCase().stream().map(ErrorCaseType::toString).collect(Collectors.joining())));
}

@Test
Expand Down
16 changes: 0 additions & 16 deletions distr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,6 @@
<type>war</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.12</version>
<scope>runtime</scope>
</dependency>
</dependencies>

</project>
2 changes: 1 addition & 1 deletion distr/src/main/etc/bin/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ echo Running BioPAX Validator...
JDK_JAVA_OPTIONS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED"
VALIDATOR_OPTS="-javaagent:lib/spring-instrument-${spring-framework.version}.jar -Xmx2g -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"

# run the validator with an alternative log4j.properties and obo.properties, e.g., from current directory -
# run the validator with an alternative log4j.properties/logback.xml or obo.properties, e.g., from current directory -
#$JAVA_HOME/bin/java -cp .:biopax-validator.jar $VALIDATOR_OPTS org.biopax.validator.Main "$1" "$2" "$3" "$4" "$5" "$6" "$7"

# run with built-in logging and OBO properties (from the default classpath)
Expand Down
6 changes: 0 additions & 6 deletions distr/src/main/etc/log4j.properties

This file was deleted.

8 changes: 2 additions & 6 deletions distr/src/main/java/org/biopax/validator/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,12 @@ private static String outFileName(Validation result) {


public static Collection<Resource> getResourcesToValidate(String input) throws IOException {
Set<Resource> setRes = new HashSet<Resource>();
Set<Resource> setRes = new HashSet<>();

File fileOrDir = new File(input);
if (fileOrDir.isDirectory()) {
// validate all the OWL files in the folder
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return (name.endsWith(".owl"));
}
};
FilenameFilter filter = (dir, name) -> (name.endsWith(".owl"));
for (String s : fileOrDir.list(filter)) {
String uri = "file:" + fileOrDir.getCanonicalPath() + File.separator + s;
setRes.add(ctx.getResource(uri));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ private DbXref createDbXref(Dbxref xref, int xrefType) {
retval.setAccession(safeTrim(xref.getDatabaseID()));
// if (retval.getAccession() != null && retval.getAccession().length() > 512) {
if (retval.getAccession() != null && retval.getAccession().length() > 256) {
System.out.println("retval.getAccession().length() = " + retval.getAccession().length());
// System.out.println("retval.getAccession().length() = " + retval.getAccession().length());
logger.warn("dbxref accession longer than allowed database column length: " + retval.getAccession());
retval.setAccession(retval.getAccession().substring(0, 256));
// retval.setAccession(retval.getAccession().substring(0, 512));
Expand Down
6 changes: 0 additions & 6 deletions obo-fetcher/src/test/java/LocalOntologyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,6 @@ public void getAllParents_unknown_accession() {
Assertions.assertEquals(0, parents.size());
}

private void printTerms(Collection<OntologyTermI> terms) {
for (OntologyTermI term : terms) {
System.out.println(term);
}
}

@Test
public final void testSearchTermByName() {
Set<OntologyTermI> term = manager.searchTermByName("O-phospho-L-serine");
Expand Down
9 changes: 0 additions & 9 deletions obo-fetcher/src/test/resources/log4j.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>
<!-- To enable JMX Management (also prints additional logback initializing info)-->
<jmxConfigurator/>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %-5level [%thread] %logger{25} - %msg%n</pattern>
<outputPatternAsHeader>true</outputPatternAsHeader>
</encoder>
</appender>
<root level="info">
<root level="debug">
<appender-ref ref="console"/>
</root>
</configuration>
32 changes: 26 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
<spring-framework.version>5.3.29</spring-framework.version>
<spring-framework.version>5.3.31</spring-framework.version>
<slf4j.version>2.0.11</slf4j.version>
<agent>${settings.localRepository}/org/springframework/spring-instrument/${spring-framework.version}/spring-instrument-${spring-framework.version}.jar</agent>
<paxtools.version>6.0.0-SNAPSHOT</paxtools.version>
<license.licenseName>MIT</license.licenseName>
Expand Down Expand Up @@ -382,17 +383,22 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>2.0.7</version>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>2.0.7</version>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
Expand Down Expand Up @@ -561,12 +567,26 @@
<!-- one of obo-fetcher's deps uses log4j directly-->
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<scope>test</scope>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
</dependencies>

Expand Down

0 comments on commit ec8a5d6

Please sign in to comment.