Is there a way to temporarily change the log level without restarting the ivy engine?

asked 27.09.2018 at 08:46

Bruno%20B%C3%BCtler's gravatar image

Bruno Bütler
56181318
accept rate: 68%


The easiest way is to use a little process with a script step and the following code:

import org.apache.log4j.Level;
ivy.log.setLevel(Level.DEBUG as Level);
link

answered 27.09.2018 at 08:52

Bruno%20B%C3%BCtler's gravatar image

Bruno Bütler
56181318
accept rate: 68%

hi @Bruno Bütler It's seem that this setting only apply for project that we run this command. For other projects on same application ,it won't work. Is there any way to make it globally for engine? Thanks

(24.10.2018 at 23:29) trungdv trungdv's gravatar image

I have enhanced this one to make it affect for application scope

public static void changeLevel(Level level){
    if(level != null) {
        Ivy.log().setLevel(level);
        org.apache.log4j.Logger root = Logger.getRootLogger();
        Enumeration allLoggers = root.getLoggerRepository().getCurrentCategories();
        //set logging level of root and all logging instances in the system
        root.setLevel(level);
        while (allLoggers.hasMoreElements()){
            Category tmpLogger = (Category) allLoggers.nextElement();
            tmpLogger.setLevel(level);
        }
    }
}

Here is an Ivy project to do this stuff on engine (with GUI)

link

answered 25.10.2018 at 00:01

trungdv's gravatar image

trungdv
(suspended)
accept rate: 52%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×44
×28
×9

Asked: 27.09.2018 at 08:46

Seen: 2,946 times

Last updated: 25.10.2018 at 00:01