Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-51004

slave.jar -loggingConfig argument not working as documented

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • remoting
    • slave.jar version 3.14
      Slaves connecting via JNLP, launched from a script.
      Custom logging.properties file provided.
      (also, my slaves were on Windows, but this might be platform-agnostic)
    • Remoting 3.30, Jenkins 2.176

      TL;DR: -loggingConfig doesn't work; Workaround is to use -Djava.util.logging.config.file.

      Long version: 
      While trying to track down mysterious slave disconnects, I needed more logging than slave.jar provided by default so, after discovering the documentation I created a file "jenkins-slave.logging.properties" containing all the java.util.logging properties that I wanted set (logging more finely, and to both the console and logfiles).
      I then invoked the slave.jar with the argument -loggingConfig jenkins-slave.logging.properties.
      However, the console output from slave.jar was unaffected.
      What I expected was that the logging would be configured according to my properties file, (but it wasn't).

      I investigated and discovered that if, instead, I provide a JVM argument of -Djava.util.logging.config.file=jenkins-slave.logging.properties then that worked perfectly.

      I also found that, if I did both then org.jenkinsci.remoting.engine.WorkDirManager's setupLogging method logged a FINE message of "Reading Logging configuration from file: jenkins-slave.logging.properties", implying that the -loggingConfig argument is being passed through correctly.

      i.e. the CLI argument parsing is working, and the configuration is getting as far as WorkDirManager, but whatever is being done with it doesn't have the desired/expected effect.

      What I would expect is that passing in a -loggingConfig argument would be (nearly) functionally identical to using -Djava.util.logging.config.file. While I would expect that anything logged before "Reading Logging configuration from file: jenkins-slave.logging.properties" would be logged with the default logging configuration (as mentioned in the docs), I would expect all subsequent logging to use the specified configuration not the default, and that's what doesn't seem to be happening.

          [JENKINS-51004] slave.jar -loggingConfig argument not working as documented

          pjdarton created issue -
          pjdarton made changes -
          Epic Link New: JENKINS-46154 [ 184393 ]
          pjdarton made changes -
          Description Original: While trying to track down mysterious slave disconnects, I needed more logging than slave.jar provided by default so, after discovering [the documentation|https://github.com/jenkinsci/remoting/blob/remoting-3.14/docs/logging.md] I created a file "{{jenkins-slave.logging.properties}}" containing all the java.util.logging properties that I wanted set (logging more finely, and to both the console and logfiles).
          I then invoked the slave.jar with the argument {{-loggingConfig jenkins-slave.logging.properties}}.
          However, the console output from slave.jar was unaffected.
          What I expected was that the logging would be configured according to my properties file, (but it wasn't).

          I investigated and discovered that if, instead, I provide a JVM argument of {{-Djava.util.logging.config.file=jenkins-slave.logging.properties}} then that worked perfectly.

          I also found that, if I did *both* then {{org.jenkinsci.remoting.engine.WorkDirManager}}'s [setupLogging method|https://github.com/jenkinsci/remoting/blob/remoting-3.14/src/main/java/org/jenkinsci/remoting/engine/WorkDirManager.java#L275] logged a {{FINE}} message of "{{Reading Logging configuration from file: jenkins-slave.logging.properties}}", implying that the {{-loggingConfig}} argument is being passed through correctly.

          i.e. the CLI argument parsing is working, and the configuration is getting as far as {{WorkDirManager}}, but whatever is being done with it doesn't have the desired/expected effect.

          What I would expect is that passing in a {{-loggingConfig}} argument would be (nearly) functionally identical to using {{-Djava.util.logging.config.file}}. While I would expect that anything logged before "{{Reading Logging configuration from file: jenkins-slave.logging.properties}}" would be logged with the default logging configuration (as mentioned in the docs), I would expect all subsequent logging to use the specified configuration not the default, and that's what doesn't seem to be happening.
          New: While trying to track down mysterious slave disconnects, I needed more logging than slave.jar provided by default so, after discovering [the documentation|https://github.com/jenkinsci/remoting/blob/remoting-3.14/docs/logging.md] I created a file "[{{jenkins-slave.logging.properties}}|https://issues.jenkins-ci.org/secure/attachment/42314/jenkins-slave.logging.properties]" containing all the java.util.logging properties that I wanted set (logging more finely, and to both the console and logfiles).
          I then invoked the slave.jar with the argument {{-loggingConfig jenkins-slave.logging.properties}}.
          However, the console output from slave.jar was unaffected.
          What I expected was that the logging would be configured according to my properties file, (but it wasn't).

          I investigated and discovered that if, instead, I provide a JVM argument of {{-Djava.util.logging.config.file=jenkins-slave.logging.properties}} then that worked perfectly.

          I also found that, if I did *both* then {{org.jenkinsci.remoting.engine.WorkDirManager}}'s [setupLogging method|https://github.com/jenkinsci/remoting/blob/remoting-3.14/src/main/java/org/jenkinsci/remoting/engine/WorkDirManager.java#L275] logged a {{FINE}} message of "{{Reading Logging configuration from file: jenkins-slave.logging.properties}}", implying that the {{-loggingConfig}} argument is being passed through correctly.

          i.e. the CLI argument parsing is working, and the configuration is getting as far as {{WorkDirManager}}, but whatever is being done with it doesn't have the desired/expected effect.

          What I would expect is that passing in a {{-loggingConfig}} argument would be (nearly) functionally identical to using {{-Djava.util.logging.config.file}}. While I would expect that anything logged before "{{Reading Logging configuration from file: jenkins-slave.logging.properties}}" would be logged with the default logging configuration (as mentioned in the docs), I would expect all subsequent logging to use the specified configuration not the default, and that's what doesn't seem to be happening.
          pjdarton made changes -
          Description Original: While trying to track down mysterious slave disconnects, I needed more logging than slave.jar provided by default so, after discovering [the documentation|https://github.com/jenkinsci/remoting/blob/remoting-3.14/docs/logging.md] I created a file "[{{jenkins-slave.logging.properties}}|https://issues.jenkins-ci.org/secure/attachment/42314/jenkins-slave.logging.properties]" containing all the java.util.logging properties that I wanted set (logging more finely, and to both the console and logfiles).
          I then invoked the slave.jar with the argument {{-loggingConfig jenkins-slave.logging.properties}}.
          However, the console output from slave.jar was unaffected.
          What I expected was that the logging would be configured according to my properties file, (but it wasn't).

          I investigated and discovered that if, instead, I provide a JVM argument of {{-Djava.util.logging.config.file=jenkins-slave.logging.properties}} then that worked perfectly.

          I also found that, if I did *both* then {{org.jenkinsci.remoting.engine.WorkDirManager}}'s [setupLogging method|https://github.com/jenkinsci/remoting/blob/remoting-3.14/src/main/java/org/jenkinsci/remoting/engine/WorkDirManager.java#L275] logged a {{FINE}} message of "{{Reading Logging configuration from file: jenkins-slave.logging.properties}}", implying that the {{-loggingConfig}} argument is being passed through correctly.

          i.e. the CLI argument parsing is working, and the configuration is getting as far as {{WorkDirManager}}, but whatever is being done with it doesn't have the desired/expected effect.

          What I would expect is that passing in a {{-loggingConfig}} argument would be (nearly) functionally identical to using {{-Djava.util.logging.config.file}}. While I would expect that anything logged before "{{Reading Logging configuration from file: jenkins-slave.logging.properties}}" would be logged with the default logging configuration (as mentioned in the docs), I would expect all subsequent logging to use the specified configuration not the default, and that's what doesn't seem to be happening.
          New: TL;DR: -loggingConfig doesn't work; Workaround is to use -Djava.util.logging.config.file.

          Long version: 
          While trying to track down mysterious slave disconnects, I needed more logging than slave.jar provided by default so, after discovering [the documentation|https://github.com/jenkinsci/remoting/blob/remoting-3.14/docs/logging.md] I created a file "[^jenkins-slave.logging.properties]" containing all the java.util.logging properties that I wanted set (logging more finely, and to both the console and logfiles).
           I then invoked the slave.jar with the argument {{-loggingConfig jenkins-slave.logging.properties}}.
           However, the console output from slave.jar was unaffected.
           What I expected was that the logging would be configured according to my properties file, (but it wasn't).

          I investigated and discovered that if, instead, I provide a JVM argument of {{-Djava.util.logging.config.file=jenkins-slave.logging.properties}} then that worked perfectly.

          I also found that, if I did *both* then {{org.jenkinsci.remoting.engine.WorkDirManager}}'s [setupLogging method|https://github.com/jenkinsci/remoting/blob/remoting-3.14/src/main/java/org/jenkinsci/remoting/engine/WorkDirManager.java#L275] logged a {{FINE}} message of "{{Reading Logging configuration from file: jenkins-slave.logging.properties}}", implying that the {{-loggingConfig}} argument is being passed through correctly.

          i.e. the CLI argument parsing is working, and the configuration is getting as far as {{WorkDirManager}}, but whatever is being done with it doesn't have the desired/expected effect.

          What I would expect is that passing in a {{-loggingConfig}} argument would be (nearly) functionally identical to using {{-Djava.util.logging.config.file}}. While I would expect that anything logged before "{{Reading Logging configuration from file: jenkins-slave.logging.properties}}" would be logged with the default logging configuration (as mentioned in the docs), I would expect all subsequent logging to use the specified configuration not the default, and that's what doesn't seem to be happening.
          Jeff Thompson made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]
          William Brode made changes -
          Assignee Original: Jeff Thompson [ jthompson ] New: William Brode [ wbrode ]
          William Brode made changes -
          Resolution Original: Cannot Reproduce [ 5 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]
          William Brode made changes -
          Status Original: Reopened [ 4 ] New: In Progress [ 3 ]
          Jeff Thompson made changes -
          Released As New: Remoting 3.30
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
          Oleg Nenashev made changes -
          Released As Original: Remoting 3.30 New: Remoting 3.30, Jenkins 2.176
          Oleg Nenashev made changes -
          Labels Original: diagnostics New: diagnostics lts-candidate

            wbrode William Brode
            pjdarton pjdarton
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: