{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "TSG091 - Get the azdata CLI logs\n", "================================\n", "\n", "Steps\n", "-----\n", "\n", "### Get the azdata logs from the local machine\n", "\n", "Gets the contents of the most recent log. There may be old logs in\n", "azdata.log.1, azdata.log.2 etc." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "from pathlib import Path\n", "\n", "home = str(Path.home())\n", "\n", "with open(os.path.join(home, \".azdata\", \"logs\", \"azdata.log\"), \"r\") as file:\n", " line = file.readline()\n", " while line:\n", " print(line.replace(\"\\n\", \"\"))\n", " line = file.readline()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print('Notebook execution complete.')" ] } ], "nbformat": 4, "nbformat_minor": 5, "metadata": { "kernelspec": { "name": "python3", "display_name": "Python 3" }, "azdata": { "side_effects": false } } }