Skip to main content

How to suppress WLS license credentials from printing to console output?



1 comment

  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi William,

    I've tried a few different approaches, both using Gurobi and not using Gurobi, and this is good as I can get it:

    with gp.Env(params={"LogToConsole":0}) as env, gp.Model("my_model", env=env) as m:
        x = m.addVar()

    The idea is to turn logging to console off when the environment is started, which is when Gurobi will look to print WLS parameters, then turn it back on when you call optimize, so that you can see the output of the solver.

    With this approach you still get "WLS license - registered to ..." but your license ID won't be printed.

    There may possibly be an approach where you hook into sys.stdout and filter the output, but it is likely to be tedious if it exists.

    Can I ask what your motivation is for wanting to suppress these lines from the output?

    - Riley



Please sign in to leave a comment.