Skip to content

Commit

Permalink
Fix/ log_file keyword was not being used in _Mapdl (#795)
Browse files Browse the repository at this point in the history
* Adding log_to_file missing option.

* Making `log_file` default to False
  • Loading branch information
germa89 authored Dec 27, 2021
1 parent 2cafb93 commit 6a2ba5a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions ansys/mapdl/core/mapdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class _MapdlCore(Commands):
"""Contains methods in common between all Mapdl subclasses"""

def __init__(self, loglevel='DEBUG', use_vtk=True, log_apdl=None,
log_file=True, local=True, **start_parm):
log_file=False, local=True, **start_parm):
"""Initialize connection with MAPDL."""
self._show_matplotlib_figures = True # for testing
self._query = None
Expand All @@ -144,8 +144,14 @@ def __init__(self, loglevel='DEBUG', use_vtk=True, log_apdl=None,
self._path = start_parm.get("run_location", None)
self._ignore_errors = False

# Setting up logger
self._log = logger.add_instance_logger(self._name, self, level=loglevel)
# Setting up loggers
self._log = logger.add_instance_logger(self._name, self, level=loglevel) # instance logger
# adding a file handler to the logger
if log_file:
if not isinstance(log_file, str):
log_file = 'instance.log'
self._log.log_to_file(filename=log_file, level=loglevel)

self._log.debug('Logging set to %s', loglevel)

from ansys.mapdl.core.parameters import Parameters
Expand Down
2 changes: 1 addition & 1 deletion ansys/mapdl/core/mapdl_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class MapdlGrpc(_MapdlCore):
_port = None

def __init__(self, ip='127.0.0.1', port=None, timeout=15, loglevel='WARNING',
log_file=True, cleanup_on_exit=False, log_apdl=None,
log_file=False, cleanup_on_exit=False, log_apdl=None,
set_no_abort=True, remove_temp_files=False, **kwargs):
"""Initialize connection to the mapdl server"""
self.__distributed = None
Expand Down

0 comments on commit 6a2ba5a

Please sign in to comment.