Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create a custom logfile for python plugin?


Hi there,
I'm developing a custom python plugin and I would like to have a dedicated logfile where I can track execution information.
I'm not a python expert neither a developer, so any suggest will be really appreciated!
I used the following command:

import logging

logging.basicConfig(format='%(asctime)s -%(levelname)s- %(message)s',

datefmt='%Y-%m-%d %H:%M:%S',



Entries in logfile are added using the following command (just an example):'start of plugin execution')

If I run the script from the command line, it works and some information are added to logfile.

Unfortunately, if the script is run by activegate no information is added to log.

Can you suggest me how to do in order to manage a custom logfile?


DynaMight Guru
DynaMight Guru

AFAIK every ActiveGate plugin has its own dedicated log file. Why are you in a need to use a custom one?

The remotepluginmodule will take care of log rotation and sizes.

My code:

logger = logging.getLogger(__name__)

class SomePluginRemote(RemoteBasePlugin):
    def initialize(self, **kwargs
    def query(self, **kwargs

This will log the entries in /var/lib/dynatrace/remotepluginmodule/log/remoteplugin/<your_plugin>

on Linux or in ProgramData directory on Windows ActiveGate.

TEMPEST a.s., Slovakia, Dynatrace Master Partner


Hi Julius, I would like to give this log file to customer in order to have a "clean" view of the steps performed by plugin.

I understand the requirement to log information, but I don't understand why the plugin log file does not fit your use case. Do you need two or more logfiles from same plugin?

TEMPEST a.s., Slovakia, Dynatrace Master Partner


Hi Julius, my idea was to centralize all the information in a single log.

Unfortunately at the moment the plugin sends data that I would like to log in two different file:


My code is:

class MYPlugin(RemoteBasePlugin):

def initialize(self, **kwargs):'Config: %s', self.config)

self.url = self.config.get('url')

self.dblist = self.config.get('db_lista')

self.terlist = self.config.get('cerca_ter')

self.minuti = self.config.get('intervallo')'variabile url: %s', self.url)'variabile db : %s', self.dblist)'variabile ter: %s', self.terlist)'variabile min: %s', self.minuti)

def query(self, **kwargs):

outputCmd = requests.get(self.url + '/be/rest/killsession/search').json()'output url: %s', outputCmd)

variables related to initialize session are logged in the second file, while outputCmd result is logged in the right file.

Any suggestion? Thanks in advance.