- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Meraki Log Location
Hello,
I would like to know if there is a way to change where the .log file generated by the API is stored. I want this in a /logs/ dir, not in the current directory where my script lives.
I don't want to suppress the log, nor do I want to manually or programmatically move it.
Solved! Go to solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
dashboard = meraki.DashboardAPI(output_log=True, print_console=False, log_path='/logs/')
# output_log (boolean): create an output log file?
# log_path (string): path to output log; by default, working directory of script if not specified
# print_console (boolean): print logging output to console?
This configuration ensures that the log files generated by the API will be stored in the '/logs/' directory.
Let me knew if this resolve you issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Untested, but try configuring output_log.
https://github.com/meraki/dashboard-api-python/blob/main/meraki/__init__.py#L79
Untested (plan B), but right before (or maybe right afterwards) initialising the class, try adding:
import logging
...
logging.getLogger('meraki').addHandler(logging.FileHandler(f'cpmr_log_{datetime.datetime.now():%Y-%m-%d_%H-%M-%S}.log'))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I basically am implementing this already. I've overridden the log, actually its pretty neat because using python logging, I can simply create a log where I want it and log away my info, warnings and errors for my script, but because I'm using the meraki module in the same runtime, all the meraki logs automatically are written in my new log within /logs.
That said, the meraki api still creates the log file in the other dir, but it's blank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
dashboard = meraki.DashboardAPI(output_log=True, print_console=False, log_path='/logs/')
# output_log (boolean): create an output log file?
# log_path (string): path to output log; by default, working directory of script if not specified
# print_console (boolean): print logging output to console?
This configuration ensures that the log files generated by the API will be stored in the '/logs/' directory.
Let me knew if this resolve you issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Worked! Thanks 🙂
I had to declare the path as './logs/'