logging in basex-api (restxq)

Thursday, 3 April 2014 · 3 messages · last reply 4 Apr 2014
MG
Maximilian Gärber3 Apr 2014 11:45 #
Hi, I'd like to use log4j with basex-api but cannot figure out how to make this work. Currently, everything goes to the console. The basex-api POM defines a dependency on slf4j-nop which as far as I undertand logs to dev/null Do I need to change the basex-api POM file to replace it with the slf4j log4j adapter? And: what setting do I need to change the target output of the trace() function? My web app POM contains these settings:
 ....
 <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <version>${jettyVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.basex</groupId>
      <artifactId>basex-api</artifactId>
      <version>${BaseXVersion}</version>
     ...
Regards, Max
CG
Christian Grün3 Apr 2014 11:52 #
Hi Max,
Quoted text · Maximilian Gärber · 3 lines
I'd like to use log4j with basex-api but cannot figure out how to make > this work. Currently, everything goes to the console. >
True. There are currently only two functions in the BaseX code that are responsible for all output to stdio [1] and stderr [2]. We may need to update them to allow the redirection of logging output to loggers such as log4j. I'm not sure if this is possible without introducing any library dependencies in the core project. Maybe someone wants to try this out? Christian [1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/util/Util.java#L127 [2] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/util/Util.java#L145
Quoted text · Maximilian Gärber · 35 lines
> The basex-api POM defines a dependency on slf4j-nop which as far as I > undertand logs to dev/null > Do I need to change the basex-api POM file to replace it with the > slf4j log4j adapter? > > And: what setting do I need to change the target output of the trace() > function? > > My web app POM contains these settings: > > .... > <dependency> > <groupId>log4j</groupId> > <artifactId>log4j</artifactId> > <version>1.2.17</version> > </dependency> > <dependency> > <groupId>org.eclipse.jetty</groupId> > <artifactId>jetty-server</artifactId> > <version>${jettyVersion}</version> > </dependency> > <dependency> > <groupId>org.basex</groupId> > <artifactId>basex-api</artifactId> > <version>${BaseXVersion}</version> > ... > > Regards, > > Max > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
JT
Joe Templeman4 Apr 2014 01:41 #
I did this in our own branch of basex and it works great, I used slf4j and the log4j bindings. Joe On Thu, Apr 3, 2014 at 2:52 AM, Christian Grün <christian.gruen at gmail.com>wrote:
Quoted text · Christian Grün · 69 lines
> Hi Max, > > I'd like to use log4j with basex-api but cannot figure out how to make >> this work. Currently, everything goes to the console. >> > > True. There are currently only two functions in the BaseX code that are > responsible for all output to stdio [1] and stderr [2]. We may need to > update them to allow the redirection of logging output to loggers such as > log4j. I'm not sure if this is possible without introducing any library > dependencies in the core project. Maybe someone wants to try this out? > > > Christian > > [1] > > https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/util/Util.java#L127 > [2] > > https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/util/Util.java#L145 > > > > > >> The basex-api POM defines a dependency on slf4j-nop which as far as I >> undertand logs to dev/null >> Do I need to change the basex-api POM file to replace it with the >> slf4j log4j adapter? >> >> And: what setting do I need to change the target output of the trace() >> function? >> >> My web app POM contains these settings: >> >> .... >> <dependency> >> <groupId>log4j</groupId> >> <artifactId>log4j</artifactId> >> <version>1.2.17</version> >> </dependency> >> <dependency> >> <groupId>org.eclipse.jetty</groupId> >> <artifactId>jetty-server</artifactId> >> <version>${jettyVersion}</version> >> </dependency> >> <dependency> >> <groupId>org.basex</groupId> >> <artifactId>basex-api</artifactId> >> <version>${BaseXVersion}</version> >> ... >> >> Regards, >> >> Max >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >

⚡Generated with XQuery