Nihamata Fashoti
Nihamata Fashoti

Reputation: 85

How to disable (deactivate ) log in Spoon?

I was wondering how can I deactivate log in Spoon (library for analyzing and transforming Java source code)?

For example, I want to disable debug log messages. However, I do not know how to set log to Info (log.setLevel(Level.INFO);)

Upvotes: 1

Views: 238

Answers (1)

ARno
ARno

Reputation: 396

The best way is to access the environment of your Spoon launcher and to use the setLevel method.

final Launcher launcher = new Launcher();
final Environment env = launcher.getEnvironment();
...
env.setLevel("OFF");
// Then apply your code analysis

As explained by the JavaDoc:

setLevel(String level): Sets the level of loggers asked by the user.

The different levels are (for the version 7.5.0): "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE", "ALL". They are the levels provided by the Apache log4j library.

http://spoon.gforge.inria.fr/mvnsites/spoon-core/apidocs/spoon/compiler/Environment.html

Upvotes: 0

Related Questions