You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update Python logging examples in documentation. (#2206)[deploy site]
* Update Python logging examples in documentation.
This adds information to the logging docs in
`documentation/webdriver/troubleshooting/`` for setting up
log handlers in Python. This is necessary to get log output.
* Add file logging to Python logging examples
---------
Co-authored-by: Sri Harsha <[email protected]>
You must also create and add a log handler (`StreamHandler`, `FileHandler`, etc).
31
+
32
+
To save logs to a file, you can do this:
33
+
```py
34
+
log_path ='/path/to/log'
35
+
handler = logging.FileHandler(log_path)
36
+
logger.addHandler(handler)
37
+
```
38
+
39
+
To display logs in the console, you can do this:
40
+
```py
41
+
handler = logging.StreamHandler()
42
+
logger.addHandler(handler)
43
+
```
30
44
{{% /tab %}}
31
45
{{% tab header="CSharp" %}}
32
46
.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.
You must also create and add a log handler (`StreamHandler`, `FileHandler`, etc).
31
+
32
+
To save logs to a file, you can do this:
33
+
```py
34
+
log_path ='/path/to/log'
35
+
handler = logging.FileHandler(log_path)
36
+
logger.addHandler(handler)
37
+
```
38
+
39
+
To display logs in the console, you can do this:
40
+
```py
41
+
handler = logging.StreamHandler()
42
+
logger.addHandler(handler)
43
+
```
30
44
{{% /tab %}}
31
45
{{% tab header="CSharp" %}}
32
46
.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.
You must also create and add a log handler (`StreamHandler`, `FileHandler`, etc).
31
+
32
+
To save logs to a file, you can do this:
33
+
```py
34
+
log_path ='/path/to/log'
35
+
handler = logging.FileHandler(log_path)
36
+
logger.addHandler(handler)
37
+
```
38
+
39
+
To display logs in the console, you can do this:
40
+
```py
41
+
handler = logging.StreamHandler()
42
+
logger.addHandler(handler)
43
+
```
30
44
{{% /tab %}}
31
45
{{% tab header="CSharp" %}}
32
46
.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.
You must also create and add a log handler (`StreamHandler`, `FileHandler`, etc).
34
+
35
+
To save logs to a file, you can do this:
36
+
```py
37
+
log_path ='/path/to/log'
38
+
handler = logging.FileHandler(log_path)
39
+
logger.addHandler(handler)
40
+
```
41
+
42
+
To display logs in the console, you can do this:
43
+
```py
44
+
handler = logging.StreamHandler()
45
+
logger.addHandler(handler)
46
+
```
33
47
{{% /tab %}}
34
48
{{% tab header="CSharp" %}}
35
49
.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.
0 commit comments