実行時設定

php.ini の設定により動作が変化します。

Seaslog 設定オプション
名前 デフォルト 変更可能 変更履歴
seaslog.appender 1 PHP_INI_SYSTEM
seaslog.appender_retry 0 PHP_INI_ALL
seaslog.level 8 PHP_INI_ALL
seaslog.remote_host 127.0.0.1 PHP_INI_ALL
seaslog.remote_port 514 PHP_INI_ALL
seaslog.remote_timeout 1 PHP_INI_SYSTEM
seaslog.default_basepath /var/log/www PHP_INI_SYSTEM
seaslog.default_logger default PHP_INI_SYSTEM
seaslog.default_template %T | %L | %P | %Q | %t | %M PHP_INI_SYSTEM
seaslog.default_datetime_format Y-m-d H:i:s PHP_INI_SYSTEM
seaslog.trace_error 1 PHP_INI_ALL
seaslog.trace_exception 0 PHP_INI_SYSTEM
seaslog.trace_notice 0 PHP_INI_ALL
seaslog.trace_warning 0 PHP_INI_ALL
seaslog.use_buffer 0 PHP_INI_SYSTEM
seaslog.buffer_size 0 PHP_INI_ALL
seaslog.buffer_disabled_in_cli 0 PHP_INI_SYSTEM
seaslog.disting_type 0 PHP_INI_SYSTEM
seaslog.disting_folder 1 PHP_INI_SYSTEM
seaslog.disting_by_hour 0 PHP_INI_SYSTEM
seaslog.recall_depth 0 PHP_INI_ALL
seaslog.trim_wrap 0 PHP_INI_ALL
seaslog.ignore_warning 1 PHP_INI_ALL
seaslog.throw_exception 1 PHP_INI_ALL

以下に設定ディレクティブに関する 簡単な説明を示します。

seaslog.appender integer

Switch the Record Log Data Store. 1File 2TCP 3UDP (Switch default 1)

SeasLog will send log to tcp://remote_host:remote_port or udp://remote_host:remote_port server, when seaslog.appender configured to `2 (TCP)` or `3 (UDP)`.

When SeasLog send log to TCP/UDP,style follow RFC5424. The `{logInfo}` affected by seaslog.default_template.

The log style finally formatted such as:
<15>1 2017-08-27T01:24:59+08:00 vagrant-ubuntu-trusty test/logger[27171]: 2016-06-25 00:59:43 | DEBUG | 21423 | 599157af4e937 | 1466787583.322 | this is a neeke debug
<14>1 2017-08-27T01:24:59+08:00 vagrant-ubuntu-trusty test/logger[27171]: 2016-06-25 00:59:43 | INFO | 21423 | 599157af4e937 | 1466787583.323 | this is a info log
<13>1 2017-08-27T01:24:59+08:00 vagrant-ubuntu-trusty test/logger[27171]: 2016-06-25 00:59:43 | NOTICE | 21423 | 599157af4e937 | 1466787583.324 | this is a notice log
    
seaslog.appender_retry integer

Record Log Retry Count. Default 0 (Do Not Retry)

seaslog.buffer_disabled_in_cli integer

Disable buffer in cli. 1-Y 0-N(Default)

Switch the configure buffer_disabled_in_cli on. The buffer_disabled_in_cli switch default off. If switch buffer_disabled_in_cli on, and running in cli, seaslog.use_buffer setting will be discarded, Seaslog write to the Data Store IMMEDIATELY.

seaslog.buffer_size integer

Configure the buffer_size with 100. The buffer_size default 0, it’s meaning don’t use buffer. If buffer_size > 0,SeasLog will rewritten down into the Data Store when the prerecorded log in memory count >= this buffer_size,and then refresh the memory poll.

seaslog.default_basepath string

Default Log Base Path. Defult "/var/log/www".

seaslog.default_datetime_format string

The DateTime Style. Default "Y-m-d H:i:s".

seaslog.default_logger string

Default Logger Path. Default "default".

seaslog.disting_by_hour integer

Switch use the logger with hour. 1-Y 0-N(Default)

注意:

seaslog.disting_by_hour = 1 Switch use Logger DisTing by hour. It’s meaning SeasLog will create the file each one hour.

seaslog.disting_folder integer

Switch use the logger with folder. 1-Y(Default) 0-N

注意:

seaslog.disting_folder = 1 Switch use Logger DisTing by folder, it’s meaning SeasLog will create the file deistic by folder, and when this configure close SeasLog will create file use underline connect Logger and Time like default_20180211.log.

seaslog.disting_type integer

Switch use the logger with type. 1-Y 0-N(Default)

注意:

seaslog.disting_type = 1 Switch use Logger DisTing by type, it’s meaning SeasLog will create the file deistic info\warn\error and the other type.

seaslog.ignore_warning integer

Switch ignore SeasLog warning. 1-On(Default) 0-Off

注意:

seaslog.ignore_warning = 1 Open a warning to ignore SeasLog itself. When directory permissions or receive server ports are blocked, they are ignored; when closed, a warning is thrown.

seaslog.level integer

Record logger level. Default 8 (All of them). 0-EMERGENCY 1-ALERT 2-CRITICAL 3-ERROR 4-WARNING 5-NOTICE 6-INFO 7-DEBUG 8-ALL

注意:

Tips: The configuration item has changed since the 1.7.0 version. Before the 1.7.0 version, the smaller the value, the more logs are taken according to the level: 0-all 1-debug 2-info 3-notice 4-warning 5-error 6-critical 7-alert 8-emergency Before the 1.7.0 version, Default 0 (All of them).

seaslog.recall_depth integer

Log function recall depth.Will affected variable `LineNo` in `%F`. Default 0

seaslog.remote_host string

If you use Record TCP or UDP, configure this remote ip. Default "127.0.0.1"

seaslog.remote_port integer

If you use Record TCP or UDP, configure this remote port. Default 514

seaslog.remote_timeout integer

If you use Record TCP or UDP, configure this remote timeout. Default 1 second

seaslog.throw_exception integer

Switch throw SeasLog exception. 1-On(Default) 0-Off

注意:

seaslog.throw_exception = 1 Open an exception that throws the SeasLog to throw itself. When the directory authority or the receive server port is blocked, throw an exception; do not throw an exception when closed.

seaslog.trace_error integer

Automatic Record final error with default logger. 1-Y(Default) 0-N

seaslog.trace_exception integer

Automatic Record exception with default logger. 1-Y 0-N(Default)

seaslog.trace_notice integer

Automatic Record notice with default logger. 1-Y 0-N(Default)

seaslog.trace_warning integer

Automatic Record warning with default logger. 1-Y 0-N(Default)

seaslog.trim_wrap integer

Trim the \n and \r in log message. 1-On 0-Off(Default)

seaslog.use_buffer integer

Switch use the log buffer with memory. 1-Y 0-N(Default)

注意:

seaslog.use_buffer = 1 Switch the configure use_buffer on. The use_buffer switch default off. If switch use_buffer on, SeasLog prerecord the log with memory, and them would be rewritten down into the Data Store by request shutdown or php process exit (PHP RSHUTDOWN or PHP MSHUTDOWN).

seaslog.default_template string

Default Log template. Default "%T | %L | %P | %Q | %t | %M".

注意:

`SeasLog`The following default variables are provided, which can be used directly in the log template and replaced as a corresponding value when the log is eventually generated.

Default log template is:`seaslog.default_template = "%T | %L | %P | %Q | %t | %M"`, that's mean,default log style is:`{dateTime} | {level} | {pid} | {uniqid} | {timeStamp} | {logInfo}`

If you custom log template, such as:`seaslog.default_template = "[%T]:%L %P %Q %t %M" `, that's will mean,log style was custom as:`[{dateTime}]:{level} {pid} {uniqid} {timeStamp} {logInfo}`

Seaslog Default Variable Table
Variable Name Description
%L Level.
%M Message.
%T DateTime. Such as`2017-08-16 19:15:02`,affected by `seaslog.default_datetime_format`.
%t Timestamp. Such as`1502882102.862`,accurate to milliseconds.
%Q RequestId. To distinguish a single request, such as not invoking the `SeasLog::setRequestId($string)` function, the unique value generated by the built-in `static char *get_uniqid ()` function is used when the request is initialized.
%H HostName.
%P ProcessId.
%D Domain:Port. Such as`www.cloudwise.com:80`; When Cli, Such as `cli`.
%R Request URI. Such as`/app/user/signin`; When Cli it's the index script, Such as `CliIndex.php`.
%m Request Method. Such as`Get`; When Cli it's the command script, Such as `/bin/bash`.
%I Client IP; When Cli it's `local`. Priority value: HTTP_X_REAL_IP > HTTP_X_FORWARDED_FOR > REMOTE_ADDR
%F FileName:LineNo. Such as `UserService.php:118`.
%U MemoryUsage. byte. Call `zend_memory_usage`.
%u PeakMemoryUsage. byte. Call `zend_memory_peak_usage`.
%C `TODO` Class::Action. Such as `UserService::getUserInfo`