V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lufyluo
V2EX  ›  互联网

JVM 内存

  •  
  •   lufyluo · 2022-06-17 10:37:34 +08:00 · 704 次点击
    这是一个创建于 671 天前的主题,其中的信息可能已经有所发展或是发生改变。

    1 、Java 中打日志会产生 String 变量吗? 2 、如果会产生,那是不是会占用堆空间?又是如何回收的?

    代码:

    private void logout(ProceedingJoinPoint point, Object result, long begin, String title) {
            MethodSignature methodSignature = (MethodSignature) point.getSignature();
            log.info("[{}] method: [{}]  request: [{}]  response: [{}]  cost: [{}ms ] ",
                    title
                    , Optional.ofNullable(methodSignature)
                            .map(MethodSignature::getMethod)
                            .map(Method::getName)
                            .orElse(""),
                    JSON.toJSONString(point.getArgs()),
                    JSON.toJSONString(result),
                    System.currentTimeMillis() - begin);
        }
    

    日志:ch.qos.logback:logback-core:jar:1.2.3:compile

    lufyluo
        1
    lufyluo  
    OP
       2022-06-28 10:13:49 +08:00
    大家有什么看法就表达一下嘛,都是交流,相互促进下撒
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5401 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 08:20 · PVG 16:20 · LAX 01:20 · JFK 04:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.