Log4j Logging Mode

In TIBCO Hawk, you can enable the log4j mode for Hawk Agent logging requirements. By default, the log4j mode is disabled for Hawk Agent. Modify the log4j configuration in the respective .tra files to enable the log4j for logging.

The configuration for Hawk Agent is included in tibhawkagent.tra at:

java.extended.properties=-Duse_log4j=false -Dlog4j.configuration=%HAWK_CONFIG_HOME%/bin/log4j_agent.properties

To enable the log4j for logging, update the value of the -Duse_log4j parameter to true in the configuration mentioned above.

Specify “-Dlog4j.configuration” as command-line parameter to override the log file configuration.

A default log4j properties file exists at CONFIG_FOLDER/bin/log4j_agent.properties. You can modify this configuration file or use your own properties file.

The logging properties specified in hawkagent.cfg for –M LogService viz. log_dir, log_max_size, log_max_num and log_level override those in log4j RootLogger’s RollingFileAppender.

Use of -log_level Parameter in Agent Configuration

If –log_level <int_value> is specified in –M LogService section of agent configuration and the value of log_level is greater than seven, the log4j root logger level is set to DEBUG.

Note:

Ensure that the log4j configuration file specified above must have at least one RollingFileAppender applied to the Root logger.
Agent logging configuration properties given in hawkagent.cfg only apply to RollingFileAppender for the Root category (Logger). If there are sub-categories with different file appenders, the agent properties do not override them.
Log4j.xml configuration file is not supported.

Mapping of TIBCO Hawk default Util Logging Levels with Log4j:

Util Logging (in Hawk Agent)

Util Logging Level

Log4j Logging Level

Log.INFO (value 0)

INFO

Log.WARNING (value 1)

WARN

Log.DEBUG (value 2)

DEBUG

Log.ERROR (value 3)

ERROR

Log.EVENT (value 4)

INFO

Log.EXCEPTION

EXCEPTION

Trace Logging (in AMI)

Util Logging Level

Log4j Logging Level

Log.ALWAYS (value 0)

DEBUG

Log.INFO (value 1)

INFO

Log.WARNING (value 2)

WARN

Log.ERROR (value 4)

ERROR

Log.DEBUG (value 8)

DEBUG

Log.AMI (value 16)

INFO