Skip to content

Commit 8dd162f

Browse files
committed
added logging_level parameter to start(...) method to influence the logging output in an easy way
1 parent c20a0b4 commit 8dd162f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Changelog
44
0.2.10 (????-??-??)
55
-------------------
66

7+
- added `logging_level` parameter to the `start` method of the `weka.core.jvm` module, enabling the user
8+
to turn off debugging output in an easy way (https://github.com/fracpete/python-weka-wrapper3/issues/40)
79
- ...
810

911

python/weka/core/jvm.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def add_system_classpath():
7171

7272

7373
def start(class_path=None, bundled=True, packages=False, system_cp=False, max_heap_size=None, system_info=False,
74-
auto_install=False):
74+
auto_install=False, logging_level=logging.DEBUG):
7575
"""
7676
Initializes the javabridge connection (starts up the JVM).
7777
@@ -89,10 +89,15 @@ def start(class_path=None, bundled=True, packages=False, system_cp=False, max_he
8989
:type system_info: bool
9090
:param auto_install: whether to automatically install missing Weka packages (based on suggestions); in conjunction with package support
9191
:type auto_install: bool
92+
:param logging_level: the logging level to use for this module, e.g., logging.DEBUG or logging.INFO
93+
:type logging_level: int
9294
"""
9395
global started
9496
global with_package_support
9597
global automatically_install_packages
98+
global logger
99+
100+
logger.setLevel(logging_level)
96101

97102
if started is not None:
98103
logger.info("JVM already running, call jvm.stop() first")

0 commit comments

Comments
 (0)