Server Log

Table of Contents

服务器日志

文件名 | 日志级别 | 调试级别 | 回滚大小 | 启用标准错误日志(stderr)

访问日志

文件名 | Piped Logger | 日志格式 | 记录头部 | 回滚大小 | 保留天数 | 压缩存档

文件名

Description

指定日志文件的路径。

Syntax

文件2

Tips

[性能建议] 将日志文件放置在一个单独的磁盘上。

日志级别

Description

指定日志文件中记录的日志级别。 可用级别(由高到低)为: ERRORWARNINGNOTICEINFODEBUG。 只有级别与当前设置相同或更高的消息将被记录(级别越低记录越详细)。

Syntax

选项

Tips

[性能建议] 使用DEBUG日志级别对 性能没有任何影响,除非调试级别没有被设置为NONE.。我们推荐将日志级别设置为DEBUG,将 调试级别值设置为NONE。这样设置意味着你的磁盘不会被调试日志塞满,但是你可以使用Toggle Debug Logging 控制调试输出。这个操作可以实时启用或关闭调试记录, 对于调试繁忙的生产服务器非常有用。

See Also

调试级别

调试级别

Description

指定调试日志级别。 要使用此功能,日志级别必须设置为DEBUG。 在“调试级别”设置为NONE时,即使日志级别 设置为DEBUG,调试日志也是被禁用的。 在正在运行的服务器上,Toggle Debug Logging可以被用于 控制调试级别而无需重启。

Syntax

选项

Tips

[性能建议] 重要!如果你不需要详细的调试日志记录, 应始终将其设置为NONE。启用调试日志记录将严重降低服务性能 ,且可能在很短时间耗尽磁盘空间。 调试日志记录包括每个请求和响应的详细信息。

我们推荐将日志级别设置为DEBUG,调试级别设置为NONE。 这些设置意味着你的磁盘不会被调试日志塞满, 但是你可以使用Toggle Debug Logging 控制调试输出。这个动作可以实时启用或关闭调试记录, 对于调试繁忙的生产服务器非常有用。

See Also

日志级别, Toggle Debug Logging

回滚大小

Description

指定何时日志文件需要回滚,也称为日志循环。 当文件大小超过回滚限制后,在使用的日志文件将在同一目录中被重命名 为log_name.mm_dd_yyyy(.sequence),一个新的日志文件将被创建。 回滚的日志文件的实际大小有时会比限制值稍微大一些。 将值设置为0将禁用日志循环。

Syntax

无符号整数

Tips

请用“K”,“M”,“G”代表千字节,兆字节和千兆字节。

启用标准错误日志(stderr)

Description

指定在接受到服务器启动的进程输出的标准错误时,是否写入到日志。 如果启用,标准错误信息将记录到服务器日志所在目录内的固定名为“stderr.log”的文件。如果禁用,所有的标准错误输出都将被丢弃。

Syntax

布尔值

Tips

如果您需要调试配置的外部应用程序,如PHP、Ruby、Java、Python、Perl,请开启该功能。

文件名

Description

指定访问日志文件的文件名。

Syntax

文件2

Tips

[性能建议] 将访问日志文件放置在一个单独的磁盘上。

Piped Logger

Description

Specifies the external application that will receive the access log data sent by LiteSpeed through a pipe on its STDIN stream (file handle is 0). When this field is specified, the access log will be sent only to the logger application and not the access log file specified in previous entry.

The logger application must be defined in External Application section first. Server-level access logging can only use an external logger application defined at the server level. Virtual host-level access logging can only use a logger application defined at the virtual host level.

The logger process is spawned in the same way as other external (CGI/FastCGI/LSAPI) processes. This means it will execute as the user ID specified in the virtual host's 外部应用程序设置UID模式 settings and will never run on behalf of a privileged user.

LiteSpeed web server performs simple load balancing among multiple logger applications if more than one instance of a logger application is configured. LiteSpeed server always attempts to keep the number of logger applications as low as possible. Only when one logger application fails to process access log entries in time will the server attempt to spawn another instance of the logger application.

If a logger crashes, the web server will start another instance but the log data in the stream buffer will be lost. It is possible to lose log data if external loggers cannot keep up with the speed and volume of the log stream.

Syntax

Select from drop down list

日志格式

Description

指定访问日志的格式。 设置之后,它将覆盖记录头部 的设定。

Syntax

字符串。日志格式的语法与Apache 2.0自定义 日志格式兼容。

Example

一般日志格式(CLF)
"%h %l %u %t \"%r\" %>s %b"

支持虚拟主机的一般日志格式
"%v %h %l %u %t \"%r\" %>s %b"

NCSA扩展/组合日志格式
"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"

记录Foobar的cookie值
"%{Foobar}C"

See Also

记录头部

记录头部

Description

指定是否记录HTTP请求头: RefererUserAgentHost

Syntax

复选框

Tips

[性能建议] 如果你不需要在访问日志中记录这些头部信息,关闭这个功能。

See Also

日志格式

保留天数

Description

指定访问日志文件将被保存在磁盘上多少天。 只有超出指定天数的回滚日志文件会被删除。 当前的日志文件不会被删除,无论它包含了多少天的数据。 如果你不想自动删除过时的、很旧的日志文件, 将该值设置为0

Syntax

无符号整数

压缩存档

Description

指定是否压缩回滚日志以节省磁盘空间。

Syntax

布尔值

Tips

日志文件是高度可压缩的,建议采取压缩以减少旧日志的磁盘占用量。