Skip to end of metadata
Go to start of metadata

Scope

  • By default JS7 components are configured to use log level INFO to limit disk space consumption.
  • Higher log levels such as DEBUG and TRACE can be used to troubleshoot unexplained behavior.
  • For the location of Log4j2 configuration files see JS7 - Log Files and Locations

Log Levels

Log levels can be modified in Log4j2 configuration files, see JS7 - Log Files and Locations.

Changes to the Log4j2 configuration are applied within 60s and do not require the JS7 component to be restarted.

Controller and Agent Log4J2 Configuration

Controller log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="WARN" shutdownHook="disable">
    <Properties>
		<Property name="TimeZone">${env:JS7_CONTROLLER_TZ:-Etc/UTC}</Property>
		<Property name="LogDir">${env:JS7_CONTROLLER_LOGS:-logs}</Property>
		<Property name="LogBasename">${env:JS7_CONTROLLER_APPNAME:-controller}</Property>
		
		<Property name="RetainDays">30d</Property>
		<Property name="MaxSizeOfRolledOverFiles">5 GB</Property>
		<Property name="MaxSizePerFile">100 MB</Property>
		
		<!-- Log level of the Root Logger. -->
		<Property name="RootLogLevel">INFO</Property>
		
		<!-- Configuration for a 2nd debug log file (OFF|DEBUG|TRACE) 
			 If this value is set to DEBUG or TRACE then the above 
			 RootLogLevel has to have the same value.
		-->
		<Property name="LogLevelOfDebugLog">OFF</Property>
		
	</Properties>
        ...
<Configuration>

Explanation:

  • The Log4j2 configuration file is the same for Controllers and Agents except for the fact that environment variables in lines 4-6 for Agents use:
    • <Property name="TimeZone">${env:JS7_AGENT_TZ:-Etc/UTC}</Property>
      <Property name="LogDir">${env:JS7_AGENT_LOGS:-logs}</Property>
      <Property name="LogBasename">${env:JS7_AGENT_APPNAME:-agent}</Property>
  • To enable debug mode modify <property name="RootLogLevel">INFO</property> and <property name="LogLevelOfDebugLog">OFF</property> to DEBUG.

JOC Cockpit Log4j2 Configuration

JOC Cockpit log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Properties>
        <Property name="TimeZone">Etc/UTC</Property>
        <Property name="RetainDays">30d</Property>
        <Property name="MaxSizeOfRolledOverFiles">5 GB</Property>
        <Property name="MaxSizePerFile">100 MB</Property>
         
        <!-- Log level of the Root Logger. -->
        <Property name="RootLogLevel">INFO</Property>
        <!-- Configurations for 2nd debug log files (OFF|DEBUG|TRACE)
             If one of these values is set to DEBUG or TRACE then the above
             RootLogLevel has to have the same value.
        -->
        <Property name="JocLogLevel">OFF</Property>
        <Property name="ServiceClusterLogLevel">OFF</Property>
        <Property name="ServiceHistoryLogLevel">OFF</Property>
        <Property name="ServiceDailyPlanLogLevel">OFF</Property>
        <Property name="ServiceCleanupLogLevel">OFF</Property>
        <Property name="ServiceMonitorLogLevel">OFF</Property>
        <Property name="AuthLogLevel">OFF</Property>
        <Property name="ConnectionPoolLogLevel">OFF</Property>
    </Properties>
    ...
<Configuration>

Explanation:

  • To enable debug mode modify <property name="RootLogLevel">INFO</property> to DEBUG. In addition, modify the value of one or more of the following properties to enable debug output with the respective debug log file: 


    Debug Log FileProperty
    joc-debug.log<Property name="JocLogLevel">DEBUG</Property>
    service-cluster-debug.log<Property name="ServiceClusterLogLevel">DEBUG</Property>
    service-history-debug.log<Property name="ServiceHistoryLogLevel">DEBUG</Property>
    service-dailyplan-debug.log<Property name="ServiceDailyPlanLogLevel">DEBUG</Property>
    service-cleanup-debug.log<Property name="ServiceCleanupLogLevel">DEBUG</Property>
    service-monitor-debug.log<Property name="ServiceMonitorLogLevel">DEBUG</Property>
    authentication-debug.log<Property name="AuthLogLevel">DEBUG</Property>
    connection-pool-debug.log<Property name="ConnectionPoolLogLevel">DEBUG</Property>

Log Rotation Settings

When switching to higher log levels such as DEBUG, TRACE then consider increased storage consumption.

By default JS7 components are configured to limit storage consumption and to limit the retention period for log files. Refer to the instructions in the JS7 - Log Rotation article to adjust settings for the max. log file size and retention period.

Debug Options

Such options are applied for specific areas of interest and are forwarded by use of the JAVA_OPTIONS environment variable.

Applying debug options requires the JS7 component in question to be restarted.

Applying Debug Options to Controller and Agent

The below examples make use of the -Djavax.net.debug=ssl Java option that is used to receive detailed information e.g. about TLS/SSL certificate handling. However, any Java options can be forwarded like this.

Log File

Output created from Java debug options is written to the stdout channel and therefore is added to the watchdog.log file in the Controller's or Agent's logs directory, see JS7 - Log Files and Locations.

Windows Operating Systems

For Windows, the JAVA_OPTIONS environment variable can be set before running the Controller or Agent start script like this: 

  • from the Windows command line or from the Controller instance start script controller_<instance>.cmd:

    Windows example to run the Controller start script with debug options
    @rem Set debug options before running the Controller start script
    set JAVA_OPTIONS="-Djavax.net.debug=ssl"
    .\controller.cmd start
    
    @rem Alternatively set debug options when running the Controller start script
    .\controller.cmd start --java-options="-Djavax.net.debug=ssl"
    
    @rem For use with a Controller Windows service add this line to the Controller instance start script controller_<instance>.cmd
    set JAVA_OPTIONS="-Djavax.net.debug=ssl"
  • from the Windows command line or from the Agent instance start script agent_4445.cmd (assuming that port 4445 is used for the Agent):

    Windows example to run the Agent instance start script with debug options
    @rem Set debug options before running the Agent start script from the command line
    set JAVA_OPTIONS="-Djavax.net.debug=ssl"
    .\agent.cmd start
    
    @rem Alternatively set debug options when running the Agent start script
    .\agent.cmd start --java-options="-Djavax.net.debug=ssl"
    
    @rem For use with an Agent Windows service add this line to the Agent instance start script agent_<port>.cmd
    set JAVA_OPTIONS="-Djavax.net.debug=ssl"
  • Alternatively, when operating the Controller or Agent as a Windows Service then from the .\service directory of the installation run
    • for a Controller: js7_controller_<controller-id>w.exe
      • where <controller-id> corresponds to the Controller ID the Controller has been installed for.
      • Example: C:\Program Files\sos-berlin.com\js7\controller\my-controller\service\js7_controller_mycontrollerw.exe
    • for an Agent: js7_agent_<port>w.exe
      • where <port> corresponds to the port that the Agent is operated for.
      • Example: C:\Program Files\sos-berlin.com\js7\agent_4445\service\js7_agent_4445w.exe
    • This brings up a utility that allows Java options to be specified:



    • Note that the Controller or Agent Windows Service has to be restarted to apply changes to Java options.

Unix Operating Systems

For Unix, the JAVA_OPTIONS environment variable can be set before running the Controller or Agent start script like this:

  • Unix example to run the Controller start script with debug options
    # Set debug options before running the Controller start script
    export JAVA_OPTIONS="-Djavax.net.debug=ssl"
    ./controller.sh start
    
    # Alternatively set debug options when running the Controller start script
    ./controller.sh start --java-options="-Djavax.net.debug=ssl"
    
    # For use with a Controller daemon add this line to the Controller instance start script controller_<instance>.sh
    export JAVA_OPTIONS="-Djavax.net.debug=ssl"
  • Unix example to run the Agent start script with debug options
    # Set debug options before running the Agent start script
    export JAVA_OPTIONS="-Djavax.net.debug=ssl"
    ./agent.sh start
    
    # Alternatively set debug options when running the Agent start script
    ./agent.sh start --java-options="-Djavax.net.debug=ssl"
    
    # For use with an Agent daemon add this line to the Agent instance start script agent_<port>.sh
    export JAVA_OPTIONS="-Djavax.net.debug=ssl"
  • Alternatively the JAVA_OPTIONS environment variable can be set with the JS7 - systemd Service Files for automated Startup / Shutdown with Unix Systems.

Applying Debug Options to JOC Cockpit

Log File

Output created from Java debug options is written to the stdout channel and therefore is added to the jetty.log file in the JOC Cockpit's logs directory, see JS7 - Log Files and Locations.

Windows Operating Systems

For Windows, the JAVA_OPTIONS environment variable can be set before running the JOC Cockpit start script like this: 

  • Only when JOC Cockpit is not installed as Windows Service then the start script C:\Program Files\sos-berlin.com\js7\joc\jetty\bin\jetty.cmd is available.

    Windows example to run the JOC Cockpit start script with debug options
    @rem Set debug options before running the JOC Cockpit start script
    set JAVA_OPTIONS="-Djavax.net.debug=ssl"
    .\jetty.cmd start
  • When operating the JOC Cockpit as a Windows Service then from the .\service directory of the installation run
    • for JOC Cockpit: js7_jocw.exe
      • Example: C:\Program Files\sos-berlin.com\js7\joc\service\js7_jocw.exe
    • This brings up a utility that allows Java options to be specified:



    • Note that the JOC Cockpit Windows Service has to be restarted to apply changes to Java options.

Unix Operating Systems

For Unix the JAVA_OPTIONS environment variable can be set before running the Jetty start script like this:

  • Unix example to run the Jetty start script with debug options
    # Set debug options before running the Jetty start script
    export JAVA_OPTIONS="-Djavax.net.debug=ssl"
    ./jetty.sh start
  • When running JOC Cockpit as a daemon then the following line can be added to the $HOME/.jocrc file of the JOC Cockpit run-time account. This file is created by the installer is used if it exists and is executable. The $HOME directory is identified from the /etc/passwd file during installation.

    Unix example to use $HOME/.jocrc with debug options
    export JAVA_OPTIONS="-Djavax.net.debug=ssl"
  • When running JOC Cockpit as a daemon then the  /etc/default/joc file can be created (requires root permission) by the user. This file is not created by the installer, it will be used if it exists and is executable. This file will not be used if the $HOME/.jocrc file is present, see above.

    Unix example to use /etc/default/joc with debug options
    export JAVA_OPTIONS="-Djavax.net.debug=ssl"
  • Alternatively the JAVA_OPTIONS environment variable can be set with the JS7 - systemd Service Files for automated Startup / Shutdown with Unix Systems.

Frequently Used Debug Options

Certificate Management 

  • When configuring certificates for secure HTTPS connections with JOC Cockpit, Controller and Agents then TLS/SSL debug options will provide detailed information e.g. about handshaking and use of certificates.
  • Use the Java option: -Djavax.net.debug=ssl or -Djavax.net.debug=all
  • Find debug output
    • of TLS/SSL certificate negotiation related to a Controller or Agent with the log file watchdog.log
    • of general authentication steps with the JOC Cockpit log file authentication-debug.log
    • of TLS/SSL connections with the JOC Cockpit log file jetty.log.



  • No labels
Write a comment…