Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8343633

The ClassLoader::print_counters() prints to stdout when logging is enabled.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • 24
    • hotspot
    • master

      The function
      ClassLoader::print_counters()

      called from
      https://github.com/openjdk/jdk/blob/3fab8e37bbebbb3930108b2015efe488b1fa1e97/src/hotspot/share/runtime/java.cpp#L362
      with
       ClassLoader::print_counters(tty);

      and prints output to tty.

      inside it checks
      https://github.com/openjdk/jdk/blob/3fab8e37bbebbb3930108b2015efe488b1fa1e97/src/hotspot/share/classfile/classLoader.cpp#L142

      `if (log_is_enabled(Info, perf, class, link)) {`

      and print if logging is enabled.

      Thus if log is redirected into file the data is printed into output which is inconsistent.


      The example:
      java -Xlog:all=trace:file=vm-%p.log::filecount=1,filesize=1 -version

      OpenJDK 64-Bit Server VM warning: dependency logging results may be inflated by VerifyDependencies
      OpenJDK 64-Bit Server VM warning: class load cause logging will not produce output without LogClassLoadingCauseFor
      Could not rename log file 'vm-1108972.log' to 'vm-1108972.log.0' (No such file or directory).
      openjdk version "24-internal" 2025-03-18
      OpenJDK Runtime Environment (fastdebug build 24-internal-adhoc.lmesnik.open)
      OpenJDK 64-Bit Server VM (fastdebug build 24-internal-adhoc.lmesnik.open, mixed mode)
      ClassLoader:
        clinit: 6885ms / 768 events
        link methods: 24ms / 14070 events
        method adapters: 21ms / 654 events
        resolve...
          invokedynamic: 4123ms / 17 events
          invokehandle: 86ms / 11 events
          CP_MethodHandle: 2892ms / 25 events
          CP_MethodType: 7ms / 29 events



            coleenp Coleen Phillimore
            lmesnik Leonid Mesnik
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: