How to adjust log levels for individual Java Classes in APIM Gateway?
The log level for the Gateway's individual Java classes is adjustable via a cluster-wide property "log.levels". Using this cluster-wide property, you can adjust the log level for the Java class that is generating the log entry. You can make log entries more verbose or less verbose, depending on how the property is written.
The Java classes make use of the following hierarchy of log levels, sorted by ascending verbosity:
As specified previously, these adjustments to Java class-level logging are done via the log.levels cluster-wide property. To do so, you will need to modify the property as follows:
<Java class name>.level = <log level>
This cluster-wide property is capable of taking multiple adjustments. To incorporate multiple adjustments, ensure that each adjustment is separated by a line break.
The implementation of this cluster-wide property will take effect dynamically 20-30 secs after the change is made and saved.
If the Gateway is generating too many log entries from a particular class, you can suppress those entries by decreasing the verbosity of that particular class.
To provide an example:
com.l7tech.external.assertions.gzip.server.ServerGzipAssertion.level = WARNING
This will ensure that only SEVERE and WARNING level messages are appending to the Gateway log files for that particular Java class. It is worth noting that error logs that are of the lower levels (INFO, CONFIG, FINE, et al) will not be logged and subsequently lost.
It may be desirable to force a Java class to log more data than is typical. In most environments, especially production environments, it is inadvisable to increase the verbosity of the entire Gateway. Not only does this have the potential to increase the load on the system, but the Gateway log files will quickly be filled, rotated, and rolled. It will also increase the amount of non-essential data in the logs.
To avoid this, you can adjust the Gateway log file to maintain more logging information for specific Java classes. If there is a particular assertion or component that is failing and needs to be investigated, you can adjust the level accordingly. For example:
com.l7tech.external.assertions.gzip.server.ServerGzipAssertion.level = FINEST
This will force the Gateway to log nearly all log information generated by that class to the Gateway log files. Please note that adjusting this log level will not necessarily mean that more data will actually be logged. If the Gateway component has additional log levels and logging information to provide for that particular level, it will be appended to the log file.