dongnao2582 2019-06-09 18:50
浏览 1020
已采纳

如何增加klog级别的详细程度?

I am using the kubernetes sample controller and I want to increase the log verbosity

On starting up the controller I tried ./sample-controller -kubeconfig=kubeconfig.yaml -v=8

Does klog require a flag to be passed in on the flag.Parse() step or can I set some env variable to increase log level?

  • 写回答

2条回答 默认 最新

  • dongnai6973 2019-06-09 19:26
    关注

    from their source code:

        flagset.Var(&logging.verbosity, "v", "number for the log level verbosity")
    
    .
    .
    .
        // get returns the value of the Level.
        func (l *Level) get() Level {
            return Level(atomic.LoadInt32((*int32)(l)))
        }
    

    so the answer is yes, all you need to do is to use the v flag.

    to know which number is which, read this article :

    With VLOG, the lower the verbose level, the more likely messages are to be logged. For example, if --v==1, VLOG(1) will log, but VLOG(2) will not log. This is opposite of the severity level, where INFO is 0, and ERROR is 2. --minloglevel of 1 will log WARNING and above. Though you can specify any integers for both VLOG macro and --v flag, the common values for them are small positive integers. For example, if you write VLOG(0), you should specify --v=-1 or lower to silence it. This is less useful since we may not want verbose logs by default in most cases. The VLOG macros always log at the INFO log level (when they log at all).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog