SeasLog 2.1.0 release supports multiple hidden Bug fix PHP7.4

2020 started down!

After a year using the feedback and community-wide, SCG (SeasX Core Group) team fixes many SeasLog hidden Bug, and support PHP7.4.

SeasLog Address:

PECL: http://pecl.php.net/package/SeasLog

Github: https://github.com/SeasX/SeasLog

Domestic Mirror: https://gitee.com/neeke/SeasLog

SeasLogger (composer package items) Address:

Github: https://github.com/SeasX/seas-logger

Domestic Mirror: https://gitee.com/neeke/seas-logger

composer packet address: https://packagist.org/packages/seasx/seas-logger

Chang Log

2.1.0

  • Support PHP7.4
  • Support getBufferCount function
  • % B supports template using preset variables, get BasePath value
  • Enhanced trim_wrap.
  • Repair Issue  # 265
  • Repair dump core issues in some scenarios using trace_performance
  • Fix the problem when acquiring PHP errors before module initialization
  • Repair using php-stream update the macro issues at PHP7
  • PHP7 fix problems in the file can not be written in the stream update

2.0.2

  • Issue Fixed  # 175  supports automatic recording PHP TopN slow approach.

  • Fixed repair preset variable templates  %C , support for Class :: Action.

1.9.1

  • Issue Fixed  # 249  add unit test cases, the repair bug setLogger.

  • Fixed repair mac osx compilation error.

1.9.0

  • The Feature new  # 240  to change the preset variable increases SeasLog method SeasLog :: setRequestVariable (key, value) , the user may support the like framework swoole

  • The Feature new  # 243  the Log array support The method of the first parameter passed as SeasLog :: debug (array).

  • Issue Fixed  # 110  supports constructor may be used New SeasLog ().

  • Issue Fixed  # 234  # 236  repair SeasLog :: analyzerDetail function Bug.

  • Issue Fixed  # 245  was added and unit test cases analyzerCount analyzerDetail.

Log template presets the variable table

The following SeasLog preset variable, the log can be used directly in the template, replacing the corresponding value in the log finally produced.

  • % L - Level log level.

  • % M - Message log information.

  • % T - DateTime as 2017-08-16 19:15:02, by seaslog.default_datetime_format affected.

  • % T - Timestamp as 1502882102.862, accurate to a few milliseconds.

  • % Q - RequestId distinguish single request, if there is no call SeasLog :: setRequestId ($ string) method, at the time of initialization request, using a method of generating unique values ​​of built-in static char * get_uniqid ().

  • % H - HostName host name.

  • % P - ProcessId process ID.

  • % D - Domain: Port Name: port number, such as: 8080; Cli the mode cli.

  • % R - Request URI requests the URI, such as / app / user / signin; Cli inlet mode file, such as CliIndex.php.

  • % M - Request Method request type, such as the GET; to execute commands such as / bin / bash the Cli mode.

  • % I - Client IP source of the IP client; Cli to the local mode. The value priority: HTTP_X_REAL_IP> HTTP_X_FORWARDED_FOR> REMOTE_ADDR

  • % F - FileName: LineNo file name: line number, such as UserService.php: 118.

  • % U - MemoryUsage current content usage, the unit byte. Call zend_memory_usage.

  • % U - PeakMemoryUsage current content using a peak, and the unit byte. Call zend_memory_peak_usage.

  • % C - Class :: Action :: method name class name, such as UserService :: getUserInfo.

  • % B - BasePath path, such as / var / log / www. By seaslog.default_basepath and setBasePath impact.

Why SeasLog

log log, is usually run record system or software application. By log analysis, users can easily understand the system or software, the operation of the application; if your application log rich enough, you can also analyze the user's operating behavior in the past, type preferences, geographical distribution or other additional information; if an application log points but also a number of levels, you can easily get analyze the health of the application, to identify problems and quickly locate and solve problems, to remedy losses.

php the error_log built, syslog function powerful and excellent properties, due to various defects (the error_log error level, no fixed format, syslog regardless module, mixed with the system log), much reduced flexibility, can not meet the application requirements.

The good news is, there are many third-party libraries log to make up for the above-mentioned defects, such as log4php, plog, Analog, etc. (Of course there are many applications in the log class project to develop their own). Among log4php the most well-known, well-designed, perfect form, complete documentation and powerful. recommend.

But log4php very poor performance in terms of performance, the figure is SeasLog ab log4php of concurrent performance testing (test environment: Ubuntu12.04 single, CPU I3, memory 16G, hard disk SATA 7200): 

Is there a log library it meets the following requirements:

  • Sub-modules, sub-level

  • Simple configuration (preferably Needless configuration)

  • Log legible format

  • Application is simple, great performance

SeasLog It is this demand should be born.

What now available

  • Convenient, standardized log records in the PHP project

  • The default log directory and configurable module

  • Specifies the log directory and access the current configuration

  • Preliminary analysis of early warning framework

  • Log buffer efficient, convenient buffer debug

  • Follow PSR-3 interface specification log

  • TCP port is connected to the transmission format of the log RFC5424

  • UDP port connected to the transmission format of the log RFC5424

  • Support RequestId distinction request

  • Support for custom logging template

  • Automatic recording errors, exceptions, performance logs (slow Method The TopN)

What is the goal

  • Convenient, standardized log records

  • Efficient massive log analysis

  • Can be configured, log multi-channel warning

Q: SeasLog performance would happen

A:

当SeasLog不开启buffer时,SeasLog是:syslog()函数的8.6倍、file_put_contents()函数的240倍、fwrite()单例情况下的36倍、fwrite()非单例情况下的211倍、monolog不开启buffer时的41倍;当SeasLog开启buffer且buffer_size为100时,SeasLog是:syslog()函数的250倍、file_put_contents()函数的6962倍、fwrite()单例情况下的1052倍、fwrite()非单例情况下的6127倍、monolog开启buffer且buffer size为100时的118倍。

Q:SeasLog日志模板都提供了哪些预置变量

A:SeasLog提供了下列预设变量,可以直接使用在日志模板中,将在日志最终生成时替换成对应值。

  • %L - Level 日志级别。
  • %M - Message 日志信息。
  • %T - DateTime 如2017-08-16 19:15:02,受seaslog.default_datetime_format影响。
  • %t - Timestamp 如1502882102.862,精确到毫秒数。
  • %Q - RequestId 区分单次请求,如没有调用SeasLog::setRequestId($string)方法,则在初始化请求时,采用内置的static char *get_uniqid()方法生成的惟一值。
  • %H - HostName 主机名。
  • %P - ProcessId 进程ID。
  • %D - Domain:Port 域名:口号,如www.cloudwise.com:8080; Cli模式下为cli
  • %R - Request URI 请求URI,如/app/user/signin; Cli模式下为入口文件,如CliIndex.php
  • %m - Request Method 请求类型,如GET; Cli模式下为执行命令,如/bin/bash
  • %I - Client IP 来源客户端IP; Cli模式下为local。取值优先级为:HTTP_X_REAL_IP > HTTP_X_FORWARDED_FOR > REMOTE_ADDR
  • %F - FileName:LineNo 文件名:行号,如UserService.php:118
  • %U - MemoryUsage 当前内容使用量,单位byte。调用zend_memory_usage
  • %u - PeakMemoryUsage 当前内容使用峰值量,单位byte。调用zend_memory_peak_usage
  • %C - Class::Action 类名::方法名,如UserService::getUserInfo。不在类中使用时,记录函数名。
  • %B - BasePath路径,如/var/log/www。受seaslog.default_basepathsetBasePath影响。

Guess you like

Origin www.oschina.net/news/112480/seaslog-2-1-0-released