@@ -23,6 +23,8 @@ of the program.
23
23
{{< /tab >}}
24
24
{{< tab header="Ruby" >}}
25
25
<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 >
26
28
{{< /tab >}}
27
29
{{< tab header="JavaScript" >}}
28
30
<pre >
@@ -48,13 +50,13 @@ Logger level helps to filter out logs based on their severity.
48
50
{{< alert-content >}}{{< /alert-content >}}
49
51
{{< /tab >}}
50
52
{{< 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 >
52
54
<p >To change the level of the logger:</p >
53
55
<pre >
54
- Selenium::WebDriver.logger.level = :fatal </pre >
56
+ Selenium::WebDriver.logger.level = :info </pre >
55
57
{{< /tab >}}
56
58
{{< 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 >
58
60
<p >To change the level of the logger:</p >
59
61
<pre >
60
62
logger.setLevel(logging.Level.INFO)</pre >
@@ -64,9 +66,9 @@ Logger level helps to filter out logs based on their severity.
64
66
{{< /tab >}}
65
67
{{< /tabpane >}}
66
68
67
- ** WARN **
69
+ ** Actionable Items **
68
70
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
70
72
for deprecations. For various reasons, Selenium project does not follow standard Semantic Versioning practices.
71
73
Our policy is to mark things as deprecated for 3 releases and then remove them.
72
74
@@ -109,14 +111,12 @@ Our policy is to mark things as deprecated for 3 releases and then remove them.
109
111
{{< /tab >}}
110
112
{{< /tabpane >}}
111
113
112
- ** INFO **
114
+ ** Useful Information **
113
115
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.
118
118
119
- Different languages have different level to log requests and response .
119
+ Different languages have different level to log information .
120
120
121
121
{{< tabpane langEqualsHeader=true text=true >}}
122
122
{{< tab header="Java" >}}
@@ -129,20 +129,19 @@ Different languages have different level to log requests and response.
129
129
{{< alert-content >}}{{< /alert-content >}}
130
130
{{< /tab >}}
131
131
{{< tab header="Ruby" >}}
132
- Logs request and response at level: <i > ` :info ` </ i >
132
+ Logs request and response at level: <code > : info </ code >
133
133
{{< /tab >}}
134
134
{{< tab header="JavaScript" >}}
135
- Logs request and response at level: <i > ` FINER ` </ i >
135
+ Logs request and response at level: <code > FINER</ code >
136
136
{{< /tab >}}
137
137
{{< tab header="Kotlin" >}}
138
138
{{< alert-content >}}{{< /alert-content >}}
139
139
{{< /tab >}}
140
140
{{< /tabpane >}}
141
141
142
- ** DEBUG **
142
+ ** Debugging Details **
143
143
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.
146
145
147
146
### 3. Log Output:
148
147
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.
162
161
<p >To store the logs in a file:</p >
163
162
<pre >
164
163
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 >
165
170
{{< /tab >}}
166
171
{{< tab header="JavaScript" >}}
167
172
<p >Send logs to console output:</p >
168
173
<pre >
169
174
logging.installConsoleHandler()</pre >
170
175
<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 >
171
191
{{< alert-content >}}
172
192
Store logs in a file.
173
193
{{< /alert-content >}}
0 commit comments