How to Configure Logging for EM 12c Management Agent

The goal of this article is to provide instruction on how to enable logging for the Enterprise Manager 12c Management Agent.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The logging properties for the agent are stored in $EMSTATE/sysman/config/emd.properties file, same as in 11.1. But the properties that control logging follow the log4j configuration syntax instead of the syntax supported by the 11.1 agent.

To active changes to the logging parameters, you can use either of the emctl commands:
emctl reload agent
emctl setproperty agent

Overview

Agent logging entries look similar to the standard log4j logging, with the only significant difference being the prefix 'Logger.' that you will see on each line. For example:


# logging properties
Logger.log4j.appender.Rolling=org.apache.log4j.RollingFileAppender
Logger.log4j.appender.Rolling.File=/orcl/core/12.1.0.1.0/agent_inst/sysman/log/gcagent.log
Logger.log4j.appender.Rolling.Append=true
Logger.log4j.appender.Rolling.MaxFileSize=5000000
Logger.log4j.appender.Rolling.MaxBackupIndex=10
Logger.log4j.appender.Rolling.layout=oracle.sysman.gcagent.util.logging.GCPattern

#
# Set root category priority to INFO and its appenders to Rolling (and Errors).
Logger.log4j.rootCategory=INFO, Rolling, Errors


If you examine all of the Logger.log4j entries in the emd.properties file, you will see different settings for an Errors appender and a Mdu appender.
Errors appender is used to direct ERROR level logging entries to $EMSTATE/sysman/log/gcagent_errors.log
Mdu appender is used to direct metadata update entries to $EMSTATE/sysman/log/gcagent_mdu.log.

Note: Neither of these two appenders' configurations should be modified.

Changing the default logging level

To enable DEBUG level logging across the entire agent, set the rootCategory property entry to use DEBUG, similarly to what is shown below.

#
# Set root category priority to INFO and its appenders to Rolling and Errors.
# Change to DEBUG level for gcagent.log
Logger.log4j.rootCategory=DEBUG, Rolling, Errors

And then reload the agent with: $emctl reload agent

Alternatively, use can also use the emctl setproperty agent command:
$ emctl setproperty agent -name 'Logger.log4j.rootCategory' -value 'DEBUG, Rolling, Errors'

Setting the number of backup log files

When you set agent logging to DEBUG level, for anything but a most-trivial agent deployment, log entries have the possibility of rolling away after less than an hour. For this reason, it is also sensible to increase the number of log file rolls if the entire agent is configured to log at the DEBUG level. The number of rolls is set through the MaxBackupIndex parameter and it represents the number of backup log files to retain. It is recommended to keep no more than 100 files:

# Increase to 100 rolls of the log (gcagent.log, gcagent.log.1,...,gcagent.log.100)
Logger.log4j.appender.Rolling.MaxBackupIndex=100
And then reload the agent with: $emctl reload agent

Alternatively, you can issue the command:

$ emctl setproperty agent -name 'Logger.log4j.appender.Rolling.MaxBackupIndex' -value 100

Example of Standard DEBUG settings

Append the following to $EMSTATE/sysman/config/emd.properties and reload the agent.

# Recommended settings to produce DEBUG level logging
Logger.log4j.rootCategory=DEBUG, Rolling, Errors
Logger.log4j.appender.Rolling.MaxBackupIndex=50
Example of Standard TRACE settings

Append the following to to $EMSTATE/sysman/config/emd.properties and reload the agent.

# Recommended settings to produce TRACE level logging
Logger.log4j.rootCategory=DEBUG, Rolling, Errors
Logger.log4j.appender.Rolling.MaxBackupIndex=100
Logger._enableTrace=true
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Comments

Post a Comment

Popular posts from this blog

Stop Oracle Clusterware or Cluster Ready Services Processes

Steps to HandlingBlock Corruption in Large Partitioned tables using EXCHANGE PARTITION method when no Backups available Metalink Note ID 1324772.1]