Configure Logging for Jetty

Logging changes

When running under the Jetty application server, the system uses Lo4j2 for logging, where the legacy JBOSS deployment utilized Log4J 1.2.   

Logging can be configured by modifying the following file:

  • <InstallDir>/jetty/base/resources/log4j2.xml

This file will not be overwritten on patching or upgrades.  If the file is missing or removed, the system will configure logging using the default configuration provided in the  following default configuration file:

  • <InstallDir>/jetty/defaults/modules/perc-logging/resources/log4j2.xml

By default all jetty logs are placed into the following location:

  • <InstallDir>/jetty/base/logs

The main Percussion log can be found at:

  • <InstallDir>/jetty/base/logs/server.log

  By default this file is configured to rotate when it is larger than 10Mb. The logging engine will rotate the log server.log.1, server.log.2, and until the default of  10 files is reached, after wihc the oldest log file will be deleted.  This setting can be changed in the log4j2.xml file.

Console logging operates differently under jetty and is configured using the console capture module.  Console output is logged to:

  • jetty/base/logs/<date>-jetty.log. 

This log file is useful when enabling low level tracing when troubleshooting SSL or other network related issues. 

Default Jetty Log Files

  • server.log - This is the main log for the Percussion server.
  • PercussionCMSService*.log - These log files are to debug the startup and shutdown of the Windows service.
  • revisionPurge.log - Logs the revision purging functionality.
  • velocity.log - Contains logging events related to velocity templates / velocity engine.
  • <date>-jetty.log - Contains events logged directly to STDOUT or STDERR captured by the capture module.

Logging Performance & Debug Output

The log4j2 implementation makes use of the log4j2 asynchronous logging feature to improve overall application performance.  It is recommend that any additional loggers configured on the system use the AsyncAppender.  Debug logging can also affect overall system performance. It is recommended that debug logging only be turned on and enabled when troubleshooting a specific problem or issue, and turned off during normal production operations. 

Enabling debug logging for a specific service can be done by adding a new AsyncLogger to the log4j2.xml configuration file and specifying a logging level of DEBUG.  Setting the logging level to INFO will return the logger to the defaults.

Common Debug Log Entries

Publishing Delivery

The below logger will log debug output for all Percussion delivery types. 

<AsyncLogger name="com.percussion.rx.delivery" level="DEBUG" includeLocation="true">

   <AppenderRef ref="CONSOLE"/>

     <AppenderRef ref="FILE"/>

</AsyncLogger>

Active Assembly

<AsyncLogger name="com.percussion.services.assembly" level="DEBUG" includeLocation="true">

   <AppenderRef ref="CONSOLE"/>

     <AppenderRef ref="FILE"/>

</AsyncLogger>

Workflow

<AsyncLogger name="com.percussion.services.workflow" level="DEBUG" includeLocation="true">

   <AppenderRef ref="CONSOLE"/>

     <AppenderRef ref="FILE"/>

</AsyncLogger>

Table Factory

<AsyncLogger name="com.percussion.tablefactory" level="DEBUG" includeLocation="true">

   <AppenderRef ref="CONSOLE"/>

     <AppenderRef ref="FILE"/>

</AsyncLogger>

Security

<AsyncLogger name="com.percussion.services.security" level="DEBUG" includeLocation="true">

   <AppenderRef ref="CONSOLE"/>

     <AppenderRef ref="FILE"/>

</AsyncLogger>

Enabling Wire Level Network Logging

When troubleshooting SSL/TLS or other network configurations (such as LDAP, SSL handshake issues, or remote publishing) it is often useful to temporarily enable debug logging at the network level.  This can be accomplished by setting a configuration property on the java command line used to start the service. 

Check to see if you have a customized jvm.ini file in the following location:  <InstallDir>/jetty/base/start.d/jvm.ini 

If you do not have this file, create it by copying <InstallDir>/jetty/defaults/start.d/jvm.ini to <InstallDir>/jetty/base/start.d/jvm.ini.  The <installDir>jetty/base/start.d/jvm.ini file will not be overwritten on patching or upgrade.

At the end of the file, on a new line add the following:

-Djavax.net.debug=all

An example jvm.ini file with the debug line added is included below:

# ---------------------------------------
# Module: jvm
# A noop module that creates an ini template useful for
# setting JVM arguments (eg -Xmx )
# ---------------------------------------
--module=jvm

--exec

-server
-Xms512m
-Xmx4096m
-XX:+HeapDumpOnOutOfMemoryError
-XX:+UseConcMarkSweepGC
-XX:+DisableExplicitGC
-XX:ParallelCMSThreads=2
-XX:+CMSClassUnloadingEnabled
-XX:CMSInitiatingOccupancyFraction=80
-Dfile.encoding=UTF8
-Dsun.jnu.encoding=UTF8
-Djava.awt.headless=true
-Djavax.net.debug=all

Save the file and stop and start the jetty service.  When network events occur, debug info will be written to <installDir>/jetty/base/logs/<date>-jetty.log

Make sure to remove this option from the jvm.ini file once troubleshooting is complete as this level of logging has significant negative impacts on production performance.

Advanced Customization of Logging

The Log4j2 logging framework provides a number of advanced configurations for logging and log routing.  Examples include sending logging events to the syslog, or snmp events, or other backend log services. Configuring these options would allow for integration of Percussion logging with other centralized log management services.

More information on available configuration options can be found in the Log4j2 documentation.

https://logging.apache.org/log4j/2.x/manual/index.html