Skip to content

Logs

Where are the adapter logs stored locally?

Logs generated by mp-test or mp-build are stored in the logs subdirectory of the project.


Where are the adapter logs stored in VMware Aria Operations?

Logs are generated and stored on the cloud proxy where the adapter is running at $ALIVE_BASE/user/log/adapters/<ADAPTERKEY>/<ADAPTER_INTERNAL_INSTANCE_ID>.

ADAPTERKEY should match the adapter key used in the manifest.txt, and the ADAPTER_INTERNAL_INSTANCE_ID should match the Internal ID found in VMware Aria Operations at Environment → Inventory → Adapter Instances → <ADAPTER_DISPLAY_NAME> → <ADAPTER_INSTANCE> in the rightmost column. The Internal ID column is not displayed by default. To display the Internal ID, enable the Internal ID column by clicking the lower left 'column' icon and then checking the Internal ID box.

highlight of the checkbox where internal id can be enabled

highlight of the internal id


What are the different log files used for?

There are five types of log files: adapter, server, build, test, and validation logs. Each log file is prepended with the type of log file followed by a number that represents rollover.

  • server.log: Contains all logs related to the HTTP server inside the container. Server logs can't be modified since the server code comes packaged inside the base-adapter Python image.

  • adapter.log Contains all logs related to the adapter. Adapter logs are all the logs generated by adapter code (e.g., the test() method or the collect() methods inside app/adapter.py).

  • test.log Contains all logs related to mp-test.

  • build.log Contains all logs related to mp-build.

  • validation.log Contains a log of the validations performed by mp-test on the collection results. Validation logs are only generated locally.


How do I add logs to my adapter?

The template adapter defines a logger variable in the adapter.py file that configures all adapter logging using adapter_logging from the Python SDK. The logger only needs to be configured once; to generate logs in other files, simply import the Python logging module. Eg.

import logging

logger = logging.getLogger(__name__)

def my_method():
  logger.info("info log")
  logger.warning("warning log")
  logger.error("error log")
  logger.debug("debug log")
   ...

Adapter logging is setup via the Setup Logging method available through the AdapterLogger class of the Java Integrations SDK. The logger only need to be set up once. To retrieve the logger, you can call the Get Logger static method:

import org.apache.logging.log4j.Logger;
import com.vmware.aria.operations.AdapterLogger;

public Class Adapter {
  public void myMethod() {
    Logger logger = AdapterLogger.getLogger();
    logger.info("info log");
    logger.warning("warning log");
    logger.error("error log");
    logger.debug("debug log");
  }

  public void myOtherMethod() {
    Logger logger = AdapterLogger.getLogger();
    logger.info("other info log");
    logger.warning("other warning log");
    logger.error("other error log");
    logger.debug("other debug log");
  }

  public static void main(String[] args){
    AdapterLogger.setupLogging("Adapter");
    Adapter instance = new Adapter();
    instance.myMethod();
    instance.myOtherMethhod();
  }
}

How do I change the server and/or adapter log level?

You can set the log levels for the server and adapter inside the loglevels.cfg file, which is located in logs/loglevels.cfg locally and on the cloud proxy at $ALIVE_BASE/user/log/adapters/<ADAPTERKEY>/<ADAPTER_INTERNAL_INSTANCE_ID>/loglevels.cfg. If the file does not exist, the system generates it after a collection/test.

ADAPTERKEY should match the name of the adapter used in the manifest.txt, and the ADAPTER_INTERNAL_INSTANCE_ID should match the Internal ID found in VMware Aria Operations at Environment → Inventory → Adapter Instances → <ADAPTER_DISPLAY_NAME> → <ADAPTER_INSTANCE> in the rightmost column. The Internal ID column is not displayed by default. To display the Internal ID, enable the Internal ID column by clicking the lower left 'column' icon and then checking the Internal ID box.

highlight of the checkbox where internal id can be enabled

highlight of the internal id


How do I change the log level of mp-init, mp-test, or mp-build?

All SDK tools read the LOG_LEVEL environment variable to set the log level of their console output. For example, to set the log level of any of the CLI tools, we can set the LOG_LEVEL variable to the desired log level:

LOG_LEVEL=debug mp-build
LOG_LEVEL=debug mp-build
set LOG_LEVEL=debug
mp-build

Information

Set the log level back to info after debugging.

The SDK CLI tools support debug, warn, info, and error levels.