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:
logging.basicConfig(format='%(asctime)s -%(levelname)s- %(message)s',
Entries in logfile are added using the following command (just an example):
logging.info('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?
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.
logger = logging.getLogger(__name__)
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.
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:
def initialize(self, **kwargs):
logger.info('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')
logger.info('variabile url: %s', self.url)
logger.info('variabile db : %s', self.dblist)
logger.info('variabile ter: %s', self.terlist)
logger.info('variabile min: %s', self.minuti)
def query(self, **kwargs):
outputCmd = requests.get(self.url + '/be/rest/killsession/search').json()
logger.info('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.