Skip to content

Commit 999e673

Browse files
committed
Added suggestions. Modified info and debugging sections
1 parent cb2bfd7 commit 999e673

File tree

1 file changed

+36
-16
lines changed
  • website_and_docs/content/documentation/webdriver/troubleshooting

1 file changed

+36
-16
lines changed

website_and_docs/content/documentation/webdriver/troubleshooting/logging.en.md

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ of the program.
2323
{{< /tab >}}
2424
{{< tab header="Ruby" >}}
2525
<p>Ruby uses a custom implementation of the default `Logger` class with some interesting additional features.</p>
26+
<pre>
27+
logger = Selenium::WebDriver.logger</pre>
2628
{{< /tab >}}
2729
{{< tab header="JavaScript" >}}
2830
<pre>
@@ -48,13 +50,13 @@ Logger level helps to filter out logs based on their severity.
4850
{{< alert-content >}}{{< /alert-content >}}
4951
{{< /tab >}}
5052
{{< tab header="Ruby" >}}
51-
<p>Levels are: <i>`:debug`, `:info`, `:warn`, `:error`, `:fatal`.</i> Default is <i>`:warn`</i>.</p>
53+
<p>Levels are: <code>:debug</code>, <code>:info</code>, <code>:warn</code>, <code>:error</code>, <code>:fatal</code>. Default is <code>:warn</code>.</p>
5254
<p>To change the level of the logger:</p>
5355
<pre>
54-
Selenium::WebDriver.logger.level = :fatal</pre>
56+
Selenium::WebDriver.logger.level = :info</pre>
5557
{{< /tab >}}
5658
{{< tab header="JavaScript" >}}
57-
<p>Levels are: <i>`OFF`, `SEVERE`, `WARNING`, `INFO`, `DEBUG`, `FINE`, `FINER`, `FINEST`, `ALL`</i>. Default is <i>`OFF`</i>.</p>
59+
<p>Levels are: <code>OFF</code>, <code>SEVERE</code>, <code>WARNING</code>, <code>INFO</code>, <code>DEBUG</code>, <code>FINE</code>, <code>FINER</code>, <code>FINEST</code>, <code>ALL</code>. Default is <code>OFF</code>.</p>
5860
<p>To change the level of the logger:</p>
5961
<pre>
6062
logger.setLevel(logging.Level.INFO)</pre>
@@ -64,9 +66,9 @@ Logger level helps to filter out logs based on their severity.
6466
{{< /tab >}}
6567
{{< /tabpane >}}
6668

67-
**WARN**
69+
**Actionable Items**
6870

69-
Warnings include everything we want users to be aware of by default. This is mostly used
71+
Things are logged as warnings if they are something the user needs to take action on. This is mostly used
7072
for deprecations. For various reasons, Selenium project does not follow standard Semantic Versioning practices.
7173
Our policy is to mark things as deprecated for 3 releases and then remove them.
7274

@@ -109,14 +111,12 @@ Our policy is to mark things as deprecated for 3 releases and then remove them.
109111
{{< /tab >}}
110112
{{< /tabpane >}}
111113

112-
**INFO**
114+
**Useful Information**
113115

114-
This is where the most useful information gets logged. Selenium logs the endpoints and payloads
115-
sent to and received from the driver or server. This is a great way to see what Selenium is actually
116-
doing under the hood, and can be used to determine if it is Selenium code or driver code that
117-
is causing a problem. (Unfortunately, we can't blame the driver if Selenium is sending incorrect syntax).
116+
This is the default level where Selenium logs things that users should be aware of but do not need to take actions on.
117+
It presents information such as requests and responses between driver and server, payload, etc.
118118

119-
Different languages have different level to log requests and response.
119+
Different languages have different level to log information.
120120

121121
{{< tabpane langEqualsHeader=true text=true >}}
122122
{{< tab header="Java" >}}
@@ -129,20 +129,19 @@ Different languages have different level to log requests and response.
129129
{{< alert-content >}}{{< /alert-content >}}
130130
{{< /tab >}}
131131
{{< tab header="Ruby" >}}
132-
Logs request and response at level: <i>`:info`</i>
132+
Logs request and response at level: <code>:info</code>
133133
{{< /tab >}}
134134
{{< tab header="JavaScript" >}}
135-
Logs request and response at level: <i>`FINER`</i>
135+
Logs request and response at level: <code>FINER</code>
136136
{{< /tab >}}
137137
{{< tab header="Kotlin" >}}
138138
{{< alert-content >}}{{< /alert-content >}}
139139
{{< /tab >}}
140140
{{< /tabpane >}}
141141

142-
**DEBUG**
142+
**Debugging Details**
143143

144-
This is less useful information where we log things about the servers and the sockets, and header information, etc.
145-
Debug mode is set if either `$DEBUG` is true or `ENV['DEBUG']` has a value.
144+
The debug log level is used for information that may be needed for diagnosing issues and troubleshooting problems.
146145

147146
### 3. Log Output:
148147
Logs can be displayed on `stdout` or stored in a file.
@@ -162,12 +161,33 @@ Logs can be displayed on `stdout` or stored in a file.
162161
<p>To store the logs in a file:</p>
163162
<pre>
164163
Selenium::WebDriver.logger.output = '/path/to/selenium.log'</pre>
164+
<br>
165+
<p>Sample Output:</p>
166+
<blockquote>
167+
2023-02-08 12:31:23 INFO Selenium -> POST session/8b83ff54712d0a247937d045f8c8e171/url<br>
168+
2023-02-08 12:31:23 INFO Selenium >>> http://127.0.0.1:9515/session/8b83ff54712d0a247937d045f8c8e171/url | {"url":"https://www.selenium.dev/selenium/web/web-form.html"}<br>
169+
2023-02-08 12:31:23 INFO Selenium <- {"value":null}</blockquote>
165170
{{< /tab >}}
166171
{{< tab header="JavaScript" >}}
167172
<p>Send logs to console output:</p>
168173
<pre>
169174
logging.installConsoleHandler()</pre>
170175
<br>
176+
<p>Sample Output:</p>
177+
<blockquote>
178+
[2023-03-21T22:28:20Z] [FINER] [webdriver.http.Executor] >>> POST /session/0208994573cca3250a1066424c1b915c/url<br>
179+
[2023-03-21T22:28:22Z] [FINER] [webdriver.http.Executor] >>>
180+
POST /session/0208994573cca3250a1066424c1b915c/url HTTP/1.1<br>
181+
accept: application/json; charset=utf-8
182+
183+
{"url":"https://www.selenium.dev/selenium/web/web-form.html"}<br>
184+
<<<
185+
HTTP/1.1 200
186+
content-length: 14
187+
content-type: application/json; charset=utf-8
188+
cache-control: no-cache
189+
190+
{"value":null}</blockquote>
171191
{{< alert-content >}}
172192
Store logs in a file.
173193
{{< /alert-content >}}

0 commit comments

Comments
 (0)