LOGGING Section

The LOGGING section configures client request log. Access log and error log are recorded separately, and their format can be configured. System logs, access logs, and error logs are all set in the LOGGING section.

Configuration Items

The following is the configuration format of the LOGGING section.

"logging": {
    "system_log": [
        {
            "name": string,
            #"level": string,                               # "INFO"
            #"dump": [string],
            #"handlers": {
                #"file_handler": {
                    "file_name": string,                    # "webtob_system.log"
                    #"rotate_by_seconds": integer,          # 0
                    #"valid_hours": integer,                # 0
                    #"rotate_by_file_size": integer,        # 0
                    #"archive_file_name": string,
                    #"enable_sync": boolean,                # false
                    #"permission": string                   # "0600"
                },
                #"enable_console_handler": boolean          # false
            }
        }
    ],
    #"access_log": [
        {
            "name": string,
            #"level": string,                               # "INFO"
            #"format": string,                              # "DEFAULT"
            #"exclude_by_ext": string,
            #"handlers": {
                #"file_handler": {
                    "file_name": string,                    # "webtob_access.log"
                    #"rotate_by_seconds": integer,          # 0
                    #"valid_hours": integer,                # 0
                    #"rotate_by_file_size": integer,        # 0
                    #"archive_file_name": string,
                    #"enable_sync": boolean,                # false
                    #"permission": string                   # "0600"
                },
                #"enable_console_handler": boolean          # false
            }
        }
    ],
    #"error_log": {
        #"level": "string",                                 # "INFO"
        #"format": "string",                                # "ERROR"
        #"enable_exclude_client_address_on_error": boolean, # false
        #"handlers": {
            #"file_handler": {
                "file_name": string,                        # "webtob_error.log"
                #"rotate_by_seconds": integer,              # 0
                #"valid_hours": integer,                    # 0
                #"rotate_by_file_size": integer,            # 0
                #"archive_file_name": string,
                #"enable_sync": boolean,                    # false
                #"permission": string                       # "0600"
            },
            #"enable_console_handler": boolean              # false
        }
    },
}

Refer to Types of Setting Values and Configuration Methods for more information on symbols and details of the LOGGING section configuration items.

system_log (Required)

Configures the system log.

Item Description

Data Type

Array (object)

system_log/name (Required)

Specifies the target system logger to be set.

Item Description

Data Type

Object

Logger names are hierarchical and separated by a period (.). The settings for loggers prioritize the lowest-level configuration. For example, if both (A)'webtob' and (B)'webtob.http' are configured, the 'webtob.http' logger follows the configuration (B), while other loggers follow the configuration (A). The top-level system logger 'webtob' must be configured.

The following describes the loggers that can be configured.

Logger Name Description

webtob.http

Manages logs related to handling HTTP messages.

webtob.wjp

Manages logs related to handling WJP messages.

webtob.ssl

Manages logs related to SSL.

webtob.network

Manages logs related to network operations.

webtob.server

Manages logs related to the startup and termination of each thread.

webtob.em.acceptor

Manages logs related to the Acceptor, which handles new connections.

webtob.em.control

Manages logs related to Admin API communication.

webtob.em.worker

Manages logs related to HTH.

webtob.util

Manages logs related to other utility functions.

The following is a configuration example:

    "system_log": [
      {
        "name": "webtob",
        "level": "DEBUG",
        "handlers": {
          "file_handler": {
            "file_name": "webtob.log"
          },
          "enable_console_handler": false
        },
        "dump": [
          "ToClient",
          "FromClient",
          "ToServer",
          "FromServer",
          "SSLRead",
          "SSLWrite"
        ]
      },
      {
        "name":"webtob.http",
        "level":"DEBUG",
        "handlers": {
          "file_handler": {
            "file_name": "webtob_http.log"
          },
          "enable_console_handler": false
        }

      }
    ]

system_log/level

Specifies the log level.

If the level of the system log message is higher than the set value, it will be output. The supported log levels from lowest to highest are "TRACE", "DEBUG", "INFO", "WARNING", "FATAL", and "OFF".

Item Description

Data Type

String

Range

"TRACE" | "DEBUG" | "INFO" | "WARNING" | "FATAL" | "OFF"

Default Value

"INFO"

The lower the level, the more detailed the log messages are output.

system_log/dump

Configures whether to output dump logs. This setting applies only when the log level is DEBUG or TRACE, and can only be set for loggers named "webtob".

Item Description

Data Type

Array (string)

Range

Up to 6 items

The following describes each configuration value.

Value Description

FromClient

Logs data sent by the client.

ToClient

Logs data sent to the client.

FromServer

Logs data sent by the server.

ToServer

Logs data sent to the server.

SSLRead

Logs data read with SSL encryption.

SSLWrite

Logs data that will be written with SSL encryption.

system_log/handlers

Sets the file and console to which log messages will be recorded.

Item Description

Data Type

Object

system_log/handlers/file_handler

Sets the file to which logs will be recorded.

Item Description

Data Type

Object

system_log/handlers/file_handler/file_name (Required)

Sets the path to the file where the system log will be stored. If the relative path does not start with a slash (/), it is automatically replaced with "$WEBTOB6_HOME_PATH/relative path".

Item Description

Data Type

String

Range

Up to 255 characters

Default Value

"webtob_system.log"

The following substitution strings specified in the file name are replaced with the actual values when the file is created. For example, a value set to "log/system_%Y%%M%%D%.log" in FileName can be replaced with "$WEBTOB6_HOME_PATH/log/system_20231023.log" when the log file is created.

The following describes each substitution string:

String Actual Value

%Y%

4-digit year (Example: 2009)

%M%

2-digit month (Example: 11)

%D%

2-digit day (Example: 05)

%h%

2-digit hour (Example: 10)

%m%

2-digit minute (Example: 30)

%s%

2-digit second (Example: 45)

system_log/handlers/file_handler/rotate_by_seconds

Specifies the maximum period of time to create a new log file. If an existing log file is older than this period of time, a new log file is created to record a new log.

Item Description

Data Type

Integer

Range

0 ~ 86400

Default Value

0

system_log/handlers/file_handler/valid_hours

Specifies the creation of a new log file at the specified interval.

Item Description

Data Type

Integer

Range

0 ~ 23

Default Value

0

system_log/handlers/file_handler/rotate_by_file_size

Specifies the file size threshold for log messages. If an existing log file surpasses this specified size, a new log file will be created.

Item Description

Data Type

Integer

Unit

bytes

Range

0 ~ INT_MAX

Default Value

0

system_log/handlers/file_handler/archive_file_name

Specifies the log file name format for an archived file. When a new log file is created, the existing log file is renamed as set in archive_file_name. New log files will then be created in the format specified in file_name.

Item Description

Data Type

String

Range

Up to 255 characters

system_log/handlers/file_handler/enable_sync

Specifies whether to write to the file immediately when logs are recorded.

Item Description

Data Type

Boolean

Default Value

False

The following describes each configuration value.

Value Description

True

Log messages are written directly to files without being buffered in WebtoB memory.

[Note] Services that require immediate logs should use this feature to immediately identify errors.

system_log/handlers/file_handler/permission

Specifies the permission for system log files.

This configuration is the same as the file access permissions used in UNIX and can be used only in a UNIX/Linux environment.

Item Description

Data Type

String

Range

"0600" ~ "0777"

system_log/handlers/enable_console_handler

Specifies whether to display the log in the console.

Item Description

Data Type

Boolean

Range

False

access_log (Required)

Configures access logs.

Item Description

Data Type

Array (object)

access_log/name

Sets the name of the access logger. This name is used to specify the target for logging access logs in other sections, such as the HTTP section.

Item Description

Data Type

Object

access_log/level

Sets the access log level.

Item Description

Data Type

String

Range

"INFO" | "OFF"

Default Value

"INFO"

The following describes each configuration value.

Value Description

OFF

Does not output access logs.

access_log/format

Sets the format of the messages to be recorded in the access log file.

Item Description

Data Type

String

Range

Up to 255 characters

The following describes each configuration value.

Value Description

DEFAULT

Default log file format.
(Log format: "%h %t \"%r\" %s %b %D")

COMMON

Common log file format.
(Log format: "%h %l %u %t \"%r\" %s %b")

COMBINED

Combined log file format.
(Log format: "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\"")

COMBINEDIO

CombinedIO log file format.
(Log format: "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O")

ERROR

Error log file format.
(Log format: "%r")

%a

Displays the IP address of the device that sent the request. Same as %h.

%A

Displays the IP address of the server.

%b

Displays the bytes of the response excluding headers.

%{_attr_name_}C

Displays the value corresponding to '_attr_name_' among the cookie header values of the HTTP request.

%d

Displays the time the response was sent.

%D

Displays the time taken to process the request (unit: milliseconds).

%{ENV_NAME}e

Displays the environment variable ENV_NAME.

%h

Displays the IP address of the device that sent the request. Same as %a.

%H

Displays the HTTP version used.

%{HEADER_FIELD}i

Displays the value of the HEADER_FIELD header of an HTTP request.

%I

Displays the bytes of the request.

%l

Displays the name for remote login.

%m

Displays the HTTP request method.

%O

Displays the bytes of the response.

%p

Displays the server port number that received the request.

%q

Displays the query value of the HTTP request.

%r

Displays the entire request line of the HTTP request.

%s

Displays the HTTP status code used in the response.

%S

Displays HTTP and HTTPS.

%t

Displays the time when the request processing is completed.

%T

Displays the time taken to process the request (unit: seconds).

%u

Displays the username used for HTTP authentication.

%U

Displays the HTTP request URI.

%v

Displays the Host Header field value.

access_log/handlers

Sets the file and console to which log messages will be recorded.

Item Description

Data Type

Object

access_log/handlers/file_handler

Sets the file to which logs will be recorded.

Item Description

Data Type

Object

access_log/handlers/file_handler/file_name (Required)

Sets the path to the file where the access log will be stored. If the relative path does not start with a slash (/), it is automatically replaced with "$WEBTOB6_HOME_PATH/relative path".

Item Description

Data Type

String

Range

Up to 255 characters

Default Value

"webtob_access.log"

The following substitution strings specified in the file name are replaced with the actual values when the file is created. For example, a value set to "log/access_%Y%%M%%D%.log" in FileName can be replaced with "$WEBTOB6_HOME_PATH/log/access_20231023.log" when the log file is created.

The following describes each substitution string:

String Actual Value

%Y%

4-digit year (Example: 2009)

%M%

2-digit month (Example: 11)

%D%

2-digit day (Example: 05)

%h%

2-digit hour (Example: 10)

%m%

2-digit minute (Example: 30)

%s%

2-digit second (Example: 45)

access_log/handlers/file_handler/rotate_by_seconds

Specifies the maximum period of time to create a new log file. If an existing log file is older than this period of time, a new log file is created to record a new log.

Item Description

Data Type

Integer

Range

0 ~ 86400

Default Value

0

access_log/handlers/file_handler/valid_hours

Specifies the creation of a new log file at the specified interval.

Item Description

Data Type

Integer

Range

0 ~ 23

Default Value

0

access_log/handlers/file_handler/rotate_by_file_size

Specifies the file size threshold for log messages. If an existing log file surpasses this specified size, a new log file will be created.

Item Description

Data Type

Integer

Unit

bytes

Range

0 ~ INT_MAX

Default Value

0

access_log/handlers/file_handler/archive_file_name

Specifies the log file name format for an archived file. When a new log file is created, the existing log file is renamed as set in archive_file_name. New log files will then be created in the format specified in file_name.

Item Description

Data Type

String

Range

Up to 255 characters

access_log/handlers/file_handler/enable_sync

Specifies whether to write to the file immediately when logs are recorded.

Item Description

Data Type

Boolean

Range

False

The following describes each configuration value.

Value Description

True

Log messages are written directly to files without being buffered in WebtoB memory.

[Note] Services that require immediate logs should use this feature to immediately identify errors.

access_log/handlers/file_handler/permission

Specifies the permission for access log files.

This configuration is the same as the file access permissions used in UNIX and can be used only in a UNIX/Linux environment.

Item Description

Data Type

String

Range

"0600" ~ "0777"

access_log/handlers/enable_console_handler

Specifies whether to display the log in the console.

Item Description

Data Type

Boolean

Default Value

False

error_log (Required)

Sets up error logs.

Item Description

Data Type

Array (object)

error_log/level

Sets the error log level.

Item Description

Data Type

String

Range

"INFO" | "OFF"

Default Value

"INFO"

The following describes each configuration value.

Value Description

OFF

Does not output error logs.

error_log/format

Sets the format of the messages to be recorded in the error log file.

Item Description

Data Type

String

Range

Up to 255 characters

The following describes each configuration value.

Value Description

DEFAULT

Default log file format.
(Log format: "%h %t \"%r\" %s %b %D")

COMMON

Common log file format.
(Log format: "%h %l %u %t \"%r\" %s %b")

COMBINED

Combined log file format.
(Log format: "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\"")

COMBINEDIO

CombinedIO log file format.
(Log format: "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O")

ERROR

Error log file format.
(Log format: "%r")

%a

Displays the IP address of the device that sent the request. Same as %h.

%A

Displays the IP address of the server.

%b

Displays the bytes of the response excluding headers.

%{_attr_name_}C

Displays the value corresponding to '_attr_name_' among the cookie header values of the HTTP request.

%d

Displays the time the response was sent.

%D

Displays the time taken to process the request (unit: milliseconds).

%{ENV_NAME}e

Displays the environment variable ENV_NAME.

%h

Displays the IP address of the device that sent the request. Same as %a.

%H

Displays the HTTP version used.

%{HEADER_FIELD}i

Displays the value of the HEADER_FIELD header of an HTTP request.

%I

Displays the bytes of the request.

%l

Displays the name for remote login.

%m

Displays the HTTP request method.

%O

Displays the bytes of the response.

%p

Displays the server port number that received the request.

%q

Displays the query value of the HTTP request.

%r

Displays the entire request line of the HTTP request.

%s

Displays the HTTP status code used in the response.

%S

Displays HTTP and HTTPS.

%t

Displays the time when the request processing is completed.

%T

Displays the time taken to process the request (unit: seconds).

%u

Displays the username used for HTTP authentication.

%U

Displays the HTTP request URI.

%v

Displays the host header field value.

error_log/handlers

Sets the file and console to which log messages will be recorded.

Item Description

Data Type

Object

error_log/handlers/file_handler

Sets the file to which logs will be recorded.

Item Description

Data Type

Object

error_log/handlers/file_handler/file_name (Required)

Sets the path to the file where the error log will be stored. If the relative path does not start with a slash (/), it is automatically replaced with "$WEBTOB6_HOME_PATH/relative path".

Item Description

Data Type

String

Range

Up to 255 characters

Default Value

"webtob_error.log"

The following substitution strings specified in the file name are replaced with the actual values when the file is created. For example, a value set to "log/error_%Y%%M%%D%.log" in FileName can be replaced with "$WEBTOB6_HOME_PATH/log/error_20231023.log" when the log file is created.

The following describes each substitution string:

String Actual Value

%Y%

4-digit year (Example: 2009)

%M%

2-digit month (Example: 11)

%D%

2-digit day (Example: 05)

%h%

2-digit hour (Example: 10)

%m%

2-digit minute (Example: 30)

%s%

2-digit second (Example: 45)

error_log/handlers/file_handler/rotate_by_seconds

Specifies the maximum period of time to create a new log file. If an existing log file is older than this period of time, a new log file is created to record a new log.

Item Description

Data Type

Integer

Range

0 ~ 86400

Default Value

0

error_log/handlers/file_handler/valid_hours

Specifies the creation of a new log file at the specified interval.

Item Description

Data Type

Integer

Range

0 ~ 23

Default Value

0

error_log/handlers/file_handler/rotate_by_file_size

Specifies the file size threshold for log messages. If an existing log file surpasses this specified size, a new log file will be created.

Item Description

Data Type

Integer

Unit

bytes

Range

0 ~ INT_MAX

Default Value

0

error_log/handlers/file_handler/archive_file_name

Specifies the log file name format for an archived file. When a new log file is created, the existing log file is renamed as set in archive_file_name. New log files will then be created in the format specified in file_name.

Item Description

Data Type

String

Range

Up to 255 characters

error_log/handlers/file_handler/enable_sync

Specifies whether to write to the file immediately when logs are recorded.

Item Description

Data Type

Boolean

Default Value

False

The following describes each configuration value.

Value Description

True

Log messages are written directly to files without being buffered in WebtoB memory.

[Note] Services that require immediate logs should use this feature to immediately identify errors.

error_log/handlers/file_handler/permission

Specifies the permission for error log files.

This configuration is the same as the file access permissions used in UNIX and can be used only in a UNIX/Linux environment.

Item Description

Data Type

String

Range

"0600" ~ "0777"

error_log/handlers/enable_console_handler

Specifies whether to display the log in the console.

Item Description

Data Type

Boolean

Default Value

False

Example

The following is an example of configuring the LOGGING section:

"logging": {
    "system_log": [
        {
            "name": "webtob",
            "level": "DEBUG",
            "handlers": {
                "file_handler": {
                    "file_name": "webtob-%Y%%M%%D%-%h%%m%%s%.log"
            }
        }
    ],
    "access_log": [
        {
            "name": "access_log1",
            "level": "INFO",
            "format": "DEFAULT",
            "handlers": {
                "file_handler": {
                    "file_name": "access-%Y%%M%%D%%s%.log"
                }
            }
        },
        {
            "name": "access_log2",
            "level": "INFO",
            "format": "DEFAULT",
            "handlers": {
                "file_handler": {
                    "file_name": "access2-%Y%%M%%D%%s%.log"
                }
            }
        }
    ],
    "error_log": {
        "level": "INFO",
        "format": "ERROR",
        "handlers": {
            "file_handler": {
                "file_name": "logs/errors%s%.log"
            }
        }
    }
}