Does log.debug decrease performance

前端 未结 5 1106
既然无缘
既然无缘 2020-12-10 13:44

I want to write some logs at the debug log which will not be available in the production logs which has info log level. So how will this extra debug logs affect the performa

5条回答
  •  无人及你
    2020-12-10 14:28

    Another technique that I'd like to point out, often used in Android development, is that you can post-process your jar to remove calls such as debug. The tool used is usually proguard. If you define the call as side-effect free, it can be removed by the optimizer ensuring pretty much zero performance penalty.... it should even be smart enough to optimize away any string construction you were doing for the log message.

    https://www.guardsquare.com/en/proguard/manual/usage#assumenosideeffects

提交回复
热议问题