Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/azure-cli-core/azure/cli/core/azlogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,15 @@ def _delete_old_logs(log_dir):

cmd_logger = logging.getLogger(AzCliLogging._COMMAND_METADATA_LOGGER)

self._init_command_logfile_handlers(cmd_logger, args) # pylint: disable=protected-access
get_logger(__name__).debug("metadata file logging enabled - writing logs to '%s'.", self.command_log_dir)
# overwrite CLILogging._is_file_log_enabled() from knack
self.file_log_enabled = cli_ctx.config.getboolean('logging', 'enable_log_file', fallback=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default for logging is no in az configure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, changing it to no could be a breaking change since the bug made the actual default to be logging enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I overwrite the implementation from knack to enable logging by default like currenty CLI does, so it's transparency to user. Not a breaking it is.


_delete_old_logs(self.command_log_dir)
if self.file_log_enabled:
self._init_command_logfile_handlers(cmd_logger, args) # pylint: disable=protected-access
get_logger(__name__).debug("metadata file logging enabled - writing logs to '%s'.",
self.command_log_dir)

_delete_old_logs(self.command_log_dir)

def _init_command_logfile_handlers(self, command_metadata_logger, args):

Expand Down