diff --git a/website_and_docs/content/documentation/webdriver/troubleshooting/logging.en.md b/website_and_docs/content/documentation/webdriver/troubleshooting/logging.en.md index c74f68d38ccd..a6acc5167f10 100644 --- a/website_and_docs/content/documentation/webdriver/troubleshooting/logging.en.md +++ b/website_and_docs/content/documentation/webdriver/troubleshooting/logging.en.md @@ -27,6 +27,20 @@ take a look at the [Selenium Logger project](https://github.com/titusfortner/sel Python logs are typically created per module. You can match all submodules by referencing the top level module. So to work with all loggers in selenium module, you can do this: {{< gh-codeblock path="/examples/python/tests/troubleshooting/test_logging.py#L5" >}} +You must also create and add a log handler (`StreamHandler`, `FileHandler`, etc). + +To save logs to a file, you can do this: +```py +log_path = '/path/to/log' +handler = logging.FileHandler(log_path) +logger.addHandler(handler) +``` + +To display logs in the console, you can do this: +```py +handler = logging.StreamHandler() +logger.addHandler(handler) +``` {{% /tab %}} {{% tab header="CSharp" %}} .NET logger is managed with a static class, so all access to logging is managed simply by referencing `Log` from the `OpenQA.Selenium.Internal.Logging` namespace. diff --git a/website_and_docs/content/documentation/webdriver/troubleshooting/logging.ja.md b/website_and_docs/content/documentation/webdriver/troubleshooting/logging.ja.md index 0d8eae36096d..cc6b92ee2e9a 100644 --- a/website_and_docs/content/documentation/webdriver/troubleshooting/logging.ja.md +++ b/website_and_docs/content/documentation/webdriver/troubleshooting/logging.ja.md @@ -27,6 +27,20 @@ take a look at the [Selenium Logger project](https://github.com/titusfortner/sel Python logs are typically created per module. You can match all submodules by referencing the top level module. So to work with all loggers in selenium module, you can do this: {{< gh-codeblock path="/examples/python/tests/troubleshooting/test_logging.py#L5" >}} +You must also create and add a log handler (`StreamHandler`, `FileHandler`, etc). + +To save logs to a file, you can do this: +```py +log_path = '/path/to/log' +handler = logging.FileHandler(log_path) +logger.addHandler(handler) +``` + +To display logs in the console, you can do this: +```py +handler = logging.StreamHandler() +logger.addHandler(handler) +``` {{% /tab %}} {{% tab header="CSharp" %}} .NET logger is managed with a static class, so all access to logging is managed simply by referencing `Log` from the `OpenQA.Selenium.Internal.Logging` namespace. diff --git a/website_and_docs/content/documentation/webdriver/troubleshooting/logging.pt-br.md b/website_and_docs/content/documentation/webdriver/troubleshooting/logging.pt-br.md index 0d8eae36096d..cc6b92ee2e9a 100644 --- a/website_and_docs/content/documentation/webdriver/troubleshooting/logging.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/troubleshooting/logging.pt-br.md @@ -27,6 +27,20 @@ take a look at the [Selenium Logger project](https://github.com/titusfortner/sel Python logs are typically created per module. You can match all submodules by referencing the top level module. So to work with all loggers in selenium module, you can do this: {{< gh-codeblock path="/examples/python/tests/troubleshooting/test_logging.py#L5" >}} +You must also create and add a log handler (`StreamHandler`, `FileHandler`, etc). + +To save logs to a file, you can do this: +```py +log_path = '/path/to/log' +handler = logging.FileHandler(log_path) +logger.addHandler(handler) +``` + +To display logs in the console, you can do this: +```py +handler = logging.StreamHandler() +logger.addHandler(handler) +``` {{% /tab %}} {{% tab header="CSharp" %}} .NET logger is managed with a static class, so all access to logging is managed simply by referencing `Log` from the `OpenQA.Selenium.Internal.Logging` namespace. diff --git a/website_and_docs/content/documentation/webdriver/troubleshooting/logging.zh-cn.md b/website_and_docs/content/documentation/webdriver/troubleshooting/logging.zh-cn.md index 1e47ae6d9901..d2c058b145f9 100644 --- a/website_and_docs/content/documentation/webdriver/troubleshooting/logging.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/troubleshooting/logging.zh-cn.md @@ -30,6 +30,20 @@ Java日志并不简单直接, Python logs are typically created per module. You can match all submodules by referencing the top level module. So to work with all loggers in selenium module, you can do this: {{< gh-codeblock path="/examples/python/tests/troubleshooting/test_logging.py#L5" >}} +You must also create and add a log handler (`StreamHandler`, `FileHandler`, etc). + +To save logs to a file, you can do this: +```py +log_path = '/path/to/log' +handler = logging.FileHandler(log_path) +logger.addHandler(handler) +``` + +To display logs in the console, you can do this: +```py +handler = logging.StreamHandler() +logger.addHandler(handler) +``` {{% /tab %}} {{% tab header="CSharp" %}} .NET logger is managed with a static class, so all access to logging is managed simply by referencing `Log` from the `OpenQA.Selenium.Internal.Logging` namespace.