views:

589

answers:

4

I downloaded a big framework which I need to built from source. The project uses a maven build structure, and includes a demo application which can be viewed with an embedded jetty. Maven plugins handle all this stuff.

However when I run the demo application (with mvn jetty:run), I can't really use it because for some reason logging on the DEBUG level is turned on and the application spends most of its time logging a lot of statements. Responsiveness is reduced to almost nothing.

The framework (geomajas 1.5.0) seems to use SLF4J, but I can't figure out where it is configured or where it can be turned off.

Any ideas welcome... thanks!

Update: Apparently they use logback. I found the configuration file (logback.xml), in which I edited out the DEBUG levels and replaced them with ERROR

To make sure the changes would propagate, I cleaned the project and rebuilt it. But the issue remains! I manually looked at the logback.xml files in the target folder, and they've updated. But I still see the log records!

Update 2 I'm on Windows 7 btw.

A: 

Try to find out a log4j configuration (if it is used for logging) - that might be log4j.xml (or log4j.properties) file. If you remove this file from classpath there will be no logging at all. If you want to reduce level of logs try to comment out some logger sections in this file, like e.g.

<!--<logger name="org.hibernate">
    <level value="debug"/> 
    <appender-ref ref="hibernate-file"/>
</logger>-->

For this example there will be no logs for classes from org.hibernate package.

cetnar
+1  A: 

looking at this slf4j manual/overview http://www.slf4j.org/manual.html it looks like you could turn off all logging by using the slf4j NOP jar (slf4j-nop-1.5.10.jar). So you'd probably need to find and replace the current slf4j implementation jar in your projects WEB-INF/lib folder with the NOP jar.

Though most likely it's using a log4j implementation, if that's the case you'd need to find the log4j.xml or log4j.properties and edit/remove them. They could be tricky to find though - first look in WEB-INF/classes and then in some sort of config directory would be a good start.

EDIT { A bit ugly but if you just want to get it up and running as fast as possible you could redirect stdout and stderr to /dev/null which should make it a bit faster as it won't be writing to disk or console:

mvn jetty:run > dev/null 2>&1 }

HTH

simonlord
I'm on Windows 7Does it have a /dev/null equivalent?
Wouter Lievens
Ah ok, then something like this:"mvn jetty:run > NUL"which i found here: http://stackoverflow.com/questions/313111/dev-null-in-windows
simonlord
+4  A: 

The simplest and most straight forward way to disable logging would be indeed to use the NOP binding. To do so, edit geomajas/geomajas-dojo-example/pom.xml and change the logging dependencies into:

    <!-- logging dependencies, delegate all to slf4j and use logback -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.5.8</version>
    </dependency>
    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-nop</artifactId>
       <version>1.5.8</version>
    </dependency>

And run mvn jetty:run.

Pascal Thivent
Works like a charm, thanks!Are you a GeoMajas user?
Wouter Lievens
You're welcome. And no, I'm not, I just took a look for the question :)
Pascal Thivent
A: 

Geomajas uses logback for the sample applications. You can configure the logging using the logback.xml file in src/main/resources.

Switching everything off can be done using a config file like:

<configuration>
    <root>
        <level value="OFF"/>
    </root>
</configuration>

Kind regards, Joachim

Joachim Van der Auwera