You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Paolo Castagna (Commented) (JIRA)" <ji...@apache.org> on 2011/11/04 11:21:00 UTC

[jira] [Commented] (JENA-36) log4j.properties can be a surprise

    [ https://issues.apache.org/jira/browse/JENA-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143887#comment-13143887 ] 

Paolo Castagna commented on JENA-36:
------------------------------------

> Maybe running the APR syntax error tests needs the log4j setup programmatically changed to not emit any messages. 

ARP tests are these:

        super("ARP") ;
        addTest( com.hp.hpl.jena.rdf.arp.TestARPMain.suite());
        addTest( com.hp.hpl.jena.rdf.arp.MoreTests.suite());
        addTest( com.hp.hpl.jena.rdf.arp.states.TestARPStates.suite());
        addTest( com.hp.hpl.jena.rdf.arp.URITests.suite());
        addTest( com.hp.hpl.jena.rdf.arp.TaintingTests.suite());
        addTest( com.hp.hpl.jena.rdf.arp.SAX2RDFTest.suite());
        addTest( com.hp.hpl.jena.rdf.arp.StAX2ModelTest.suite());

Here is how I am trying to approach this issue and try to remove the errors we see when running tests:

 public class SAX2RDFTest extends TestCase {
 
 	protected static Logger logger = LoggerFactory.getLogger( testReaderInterface.class );
+	static {
+		RDFDefaultErrorHandler.silent = true; // JENA-36
+	}
     
 public class StAX2ModelTest extends TestCase {
 
    protected static Logger logger = LoggerFactory.getLogger(testReaderInterface.class);
+	static {
+		RDFDefaultErrorHandler.silent = true; // JENA-36
+	}
+    

In the .classpath (this is so that when you run tests in Eclipse the src/test/resources/log4j.properties file is used):

+  <classpathentry kind="src" path="src/test/resources" excluding="**/*.java"/>

I commented/uncommented the test suites, one at the time to find out which suite was logging ERRORs.
Now I am at a point where:

 1. if I comment MoreTests.suite() I do *not* see ERRORs logged.
 2. if I comment all the test suites but MoreTests.suite() I do *not* see ERRORs logged.

Therefore, there must be some interaction between tests (which isn't good).
Also, RDFDefaultErrorHandler.silent = true isn't a great thing to do, but I have no better idea.
                
> log4j.properties can be a surprise
> ----------------------------------
>
>                 Key: JENA-36
>                 URL: https://issues.apache.org/jira/browse/JENA-36
>             Project: Jena
>          Issue Type: Bug
>            Reporter: Benson Margulies
>            Assignee: Paolo Castagna
>            Priority: Minor
>
> The jena jar, and perhaps others, has a log4j.properties on behalf of the commands. A little classpath confusion can end up with this at the head of the line of an app that is incorporating the jar.
> It would be more better, if you ask me, for the commands to use the -D for log4j to ask for a different file name, and leave *that* in the jar.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira