Skip to content

Commit 181f70b

Browse files
authored
Update Chinese translation on logging (SeleniumHQ#1490)
1 parent 60f2eb9 commit 181f70b

File tree

1 file changed

+41
-34
lines changed
  • website_and_docs/content/documentation/webdriver/troubleshooting

1 file changed

+41
-34
lines changed

website_and_docs/content/documentation/webdriver/troubleshooting/logging.zh-cn.md

+41-34
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
---
2-
title: "Logging Selenium commands"
3-
linkTitle: "Logging"
2+
title: "记录 Selenium 命令"
3+
linkTitle: "日志"
44
weight: 4
55
description: >
6-
Getting information about Selenium execution.
6+
获取Selenium的执行信息.
77
---
88

9-
Turning on logging is a valuable way to get extra information that might help you determine
10-
why you might be having a problem.
9+
启用日志记录是获取额外信息的宝贵方法,
10+
这些信息可能有助于您确定
11+
遇到问题的原因.
1112

12-
## Getting a logger
13+
## 获取一个logger
1314

1415
{{< tabpane langEqualsHeader=true text=true >}}
1516
{{% tab header="Java" %}}
16-
Java logs are typically created per class. You can work with the default logger to
17-
work with all loggers. To filter out specific classes, see [Filtering](#logger-filtering)
17+
Java 日志通常是按类创建的.
18+
您可以通过默认logger来使用所有loggers.
19+
为了过滤特定类, 请参考 [过滤器](#logger-过滤)
1820

19-
Get the root logger:
21+
获取根logger:
2022
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/troubleshooting/LoggingTest.java#L31" >}}
2123

22-
Java Logging is not exactly straightforward, and if you are just looking for an easy way
23-
to look at the important Selenium logs,
24-
take a look at the [Selenium Logger project](https://github.com/titusfortner/selenium-logger#selenium-logger)
24+
Java日志并不简单直接,
25+
如果您只是在寻找一种简单的方法
26+
查看重要的Selenium日志,
27+
请参阅 [Selenium Logger 项目](https://github.com/titusfortner/selenium-logger#selenium-logger)
2528
{{% /tab %}}
2629
{{% tab header="Python" %}}
2730
Python logs are typically created per module. You can match all submodules by referencing the top
@@ -54,15 +57,15 @@ logger = logging.getLogger('webdriver')
5457
{{< /tab >}}
5558
{{< /tabpane >}}
5659

57-
## Logger level
58-
Logger level helps to filter out logs based on their severity.
60+
## 日志级别
61+
Logger级别有助于根据日志的严重性过滤日志.
5962

6063
{{< tabpane langEqualsHeader=true text=true >}}
6164
{{% tab header="Java" %}}
62-
Java has 7 logger levels: `SEVERE`, `WARNING`, `INFO`, `CONFIG`, `FINE`, `FINER`, and `FINEST`.
63-
The default is `INFO`.
65+
Java有七种logger级别: `SEVERE`, `WARNING`, `INFO`, `CONFIG`, `FINE`, `FINER`, 以及 `FINEST`.
66+
默认是 `INFO`.
6467

65-
You have to change both the level of the logger and the level of the handlers on the root logger:
68+
您必须更改logger的级别和根logger上的处理程序的级别:
6669
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/troubleshooting/LoggingTest.java#L32-L35" >}}
6770
{{% /tab %}}
6871
{{% tab header="Python" %}}
@@ -120,14 +123,15 @@ logger.setLevel(logging.Level.INFO)
120123

121124
### Actionable items
122125

123-
Things are logged as warnings if they are something the user needs to take action on. This is often used
124-
for deprecations. For various reasons, Selenium project does not follow standard Semantic Versioning practices.
125-
Our policy is to mark things as deprecated for 3 releases and then remove them, so deprecations
126-
may be logged as warnings.
126+
对于需要用户后续行动的操作, 会将其记录为警告.
127+
这经常用于被弃用的内容.
128+
由于各种原因, Selenium项目不遵循标准的语义版本控制实践.
129+
我们的政策是将 3 个版本的内容标记为已弃用后,
130+
再删除它们, 因此弃用可能记录为警告.
127131

128132
{{< tabpane langEqualsHeader=true text=true >}}
129133
{{% tab header="Java" %}}
130-
Java logs actionable content at logger level `WARN`
134+
Java 日志可操作的内容在logger级别 `WARN`
131135

132136
Example:
133137
```text
@@ -169,12 +173,12 @@ For example:
169173

170174
### Useful information
171175

172-
This is the default level where Selenium logs things that users should be aware of but do not need to take actions on.
173-
This might reference a new method or direct users to more information about something
176+
这是默认级别, Selenium 记录用户应该注意但不需要对其执行操作的内容.
177+
这可能会引用新方法或将用户定向到有关某些内容的详细信息
174178

175179
{{< tabpane langEqualsHeader=true text=true >}}
176180
{{% tab header="Java" %}}
177-
Java logs useful information at logger level `INFO`
181+
Java 日志有用的信息在logger 级别 `INFO`
178182

179183
Example:
180184
```text
@@ -214,11 +218,11 @@ Example:
214218

215219
### Debugging Details
216220

217-
The debug log level is used for information that may be needed for diagnosing issues and troubleshooting problems.
221+
调试日志级别用于诊断问题和解决问题可能需要的信息.
218222

219223
{{< tabpane langEqualsHeader=true text=true >}}
220224
{{% tab header="Java" %}}
221-
Java logs most debug content at logger level `FINE`
225+
Java日志的大多数调试信息在logger 级别 `FINE`
222226

223227
Example:
224228
```text
@@ -255,13 +259,15 @@ Example:
255259
{{< /tab >}}
256260
{{< /tabpane >}}
257261

258-
## Logger output
262+
## Logger 输出
259263

260-
Logs can be displayed in the console or stored in a file. Different languages have different defaults.
264+
日志可以显示在控制台中, 也可以存储在文件中.
265+
不同的语言有不同的默认值.
261266

262267
{{< tabpane langEqualsHeader=true text=true >}}
263268
{{% tab header="Java" %}}
264-
By default all logs are sent to `System.err`. To direct output to a file, you need to add a handler:
269+
默认情况下, 所有日志都发送到 `System.err`.
270+
要将输出定向到文件, 您需要添加一个处理程序:
265271

266272
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/troubleshooting/LoggingTest.java#L37-L38" >}}
267273
{{% /tab %}}
@@ -294,13 +300,14 @@ logging.installConsoleHandler()
294300
{{< /tab >}}
295301
{{< /tabpane >}}
296302

297-
## Logger filtering
303+
## Logger 过滤
298304

299305
{{< tabpane langEqualsHeader=true text=true >}}
300306
{{% tab header="Java" %}}
301-
Java logging is managed on a per class level, so
302-
instead of using the root logger (`Logger.getLogger("")`), set the level you want to use on a per-class
303-
basis:
307+
Java 日志记录是按类级别管理的,
308+
因此不要使用根logger (`Logger.getLogger("")`),
309+
而是在每个类的基础上设置要使用的级别:
310+
304311
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/troubleshooting/LoggingTest.java#L40-L41" >}}
305312
{{% /tab %}}
306313
{{< tab header="Python" >}}

0 commit comments

Comments
 (0)