diff --git a/docker/advanced_settings.md b/docker/advanced_settings.md index 8d02c348c..06561e552 100644 --- a/docker/advanced_settings.md +++ b/docker/advanced_settings.md @@ -313,7 +313,7 @@ Notes on a couple of the parameters: in the range of 0 .. (num-gpu-1) in a round-robin fashion. **By default MMS uses all the available GPUs but this parameter can be configured if user want to use only few of them**. ```properties -# vmargs=-Xmx1g -XX:MaxDirectMemorySize=512m -Dlog4j.configuration=file:///opt/ml/conf/log4j.properties +# vmargs=-Xmx1g -XX:MaxDirectMemorySize=512m -Dlog4j.configurationFile=file:///opt/ml/conf/log4j2.xml # model_store=/opt/ml/model # load_models=ALL # inference_address=http://0.0.0.0:8080 diff --git a/docs/configuration.md b/docs/configuration.md index 7f082e8af..783d753ed 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -20,7 +20,7 @@ User can following parameters to start MMS, those parameters will override defau * **--mms-config** MMS will load specified configuration file if MMS_CONFIG_FILE is not set. * **--model-store** This parameter will override `model_store` property in config.properties file. * **--models** This parameter will override `load_models' property in config.properties. -* **--log-config** This parameter will override default log4j.properties. +* **--log-config** This parameter will override default log4j2.xml * **--foreground** This parameter will run the model server in foreground. If this option is disabled, the model server will run in the background. diff --git a/docs/logging.md b/docs/logging.md index accbe4f88..ce007ac08 100644 --- a/docs/logging.md +++ b/docs/logging.md @@ -4,9 +4,7 @@ In this document we will go through logging mechanism in Multi Model Server. We metrics, as metrics are logged into a file. To further understand how to customize metrics or define custom logging layouts, refer to the [metrics document](metrics.md) # Pre-requisites -Before getting into this tutorials, you must familiarize yourself with log4j configuration properties. Refer to this online [document](https://logging.apache.org/log4j/2.x/manual/configuration.html) -on how to configure the log4j parameters. Similarly, familiarize yourself with the default [log4j.properties](../frontend/server/src/main/resources/log4j.properties) used by -Multi Model Server. +Before getting into this tutorials, you must familiarize yourself with log4j2 configuration. Refer to this online [document](https://logging.apache.org/log4j/2.x/manual/configuration.html) on how to configure the log4j2 parameters. Similarly, familiarize yourself with the default [log4j2.xml](../frontend/server/src/main/resources/log4j2.xml) used by Multi Model Server. # Types of logs Multi Model Server currently provides three types of logs. @@ -15,16 +13,18 @@ Multi Model Server currently provides three types of logs. ## Access Logs: These logs collect the access pattern to Multi Model Server. The configuration pertaining to access logs are as follows, -```properties -log4j.logger.ACCESS_LOG = INFO, access_log - - -log4j.appender.access_log = org.apache.log4j.RollingFileAppender -log4j.appender.access_log.File = ${LOG_LOCATION}/access_log.log -log4j.appender.access_log.MaxFileSize = 100MB -log4j.appender.access_log.MaxBackupIndex = 5 -log4j.appender.access_log.layout = org.apache.log4j.PatternLayout -log4j.appender.access_log.layout.ConversionPattern = %d{ISO8601} - %m%n +```xml + + + + + + + + ``` As defined in the properties file, the access logs are collected in {LOG_LOCATION}/access_log.log file. When we load the model server @@ -39,16 +39,18 @@ These logs are useful to determine the current performance of the model-server a ## Model Server Logs These logs collect all the logs from Model Server and from the backend workers (the custom model code). The default configuration pertaining to mms logs are as follows: -```properties -log4j.logger.com.amazonaws.ml.mms = DEBUG, mms_log - - -log4j.appender.mms_log = org.apache.log4j.RollingFileAppender -log4j.appender.mms_log.File = ${LOG_LOCATION}/mms_log.log -log4j.appender.mms_log.MaxFileSize = 100MB -log4j.appender.mms_log.MaxBackupIndex = 5 -log4j.appender.mms_log.layout = org.apache.log4j.PatternLayout -log4j.appender.mms_log.layout.ConversionPattern = %d{ISO8601} [%-5p] %t %c - %m%n +```xml + + + + + + + + ``` This configuration by default dumps all the logs above `DEBUG` level. @@ -73,15 +75,14 @@ e... ``` # Modifying the behavior of the logs -In order to modify the default behavior of the logging, you could define `log4j.properties` file. There are two ways of starting +In order to modify the default behavior of the logging, you could define `log4j2.xml` file. There are two ways of starting model server with custom logs ### Provide with config.properties - Once you define custom `log4j.properties`, add this to the -`config.properties` file as follows + Once you define custom `log4j2.xml`, add this to the `config.properties` file as follows ```properties -vmargs=-Dlog4j.configuration=file:///path/to/custom/log4j.properties +vmargs=-Dlog4j.configurationFile=file:///path/to/custom/log4j2.xml ``` Then start the model server as follows ```bash @@ -91,7 +92,7 @@ $ multi-model-server --start --mms-config /path/to/config.properties Alternatively, you could start the model server with the following command as well ```bash -$ multi-model-server --start --log-config /path/to/custom/log4j.properties +$ multi-model-server --start --log-config /path/to/custom/log4j2.xml ``` # Enable asynchronous logging diff --git a/docs/metrics.md b/docs/metrics.md index 1ded715ce..76232615f 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -13,7 +13,7 @@ Metrics are collected by default at: * System metrics - log_directory/mms_metrics.log * Custom metrics - log directory/model_metrics.log -The location of log files and metric files can be configured at [log4j.properties](https://github.com/awslabs/multi-model-server/blob/master/frontend/server/src/main/resources/log4j.properties) file. +The location of log files and metric files can be configured at [log4j2.xml](https://github.com/awslabs/multi-model-server/blob/master/frontend/server/src/main/resources/log4j2.xml) file. ## System Metrics @@ -41,13 +41,7 @@ CPUUtilization.Percent:0.0|#Level:Host|#hostname:my_machine_name MemoryUsed.Megabytes:13840.328125|#Level:Host|#hostname:my_machine_name ``` -To enable metric logging in JSON format, we can modify the log formatter in [log4j.properties](https://github.com/awslabs/multi-model-server/blob/master/frontend/server/src/main/resources/log4j.properties), This is explained in the logging [document](https://github.com/awslabs/multi-model-server/blob/master/docs/logging.md). - -to enable JSON formatting for metrics change it to - -```properties -log4j.appender.mms_metrics.layout = com.amazonaws.ml.mms.util.logging.JSONLayout -``` +To enable metric logging in JSON format, we can modify the log formatter in [log4j2.xml](https://github.com/awslabs/multi-model-server/blob/master/frontend/server/src/main/resources/log4j2.xml), This is explained in the logging [document](https://github.com/awslabs/multi-model-server/blob/master/docs/logging.md). Once enabled the format emitted to logs, will look as follows diff --git a/docs/server.md b/docs/server.md index 4001f8e2c..c8c7b516b 100644 --- a/docs/server.md +++ b/docs/server.md @@ -131,7 +131,7 @@ There are no default required arguments to start the server c) Multiple models loading are also supported by specifying multiple name path pairs. 1. **model-store**: optional, A location where models are stored by default, all models in this location are loaded, the model name is same as archive or folder name. 1. **mms-config**: optional, provide a [configuration](configuration.md) file in config.properties format. -1. **log-config**: optional, This parameter will override default log4j.properties, present within the server. +1. **log-config**: optional, This parameter will override default log4j2.xml, present within the server. 1. **start**: optional, A more descriptive way to start the server. 1. **stop**: optional, Stop the server if it is already running. diff --git a/mms/model_server.py b/mms/model_server.py index acce0579a..70cc9ed93 100644 --- a/mms/model_server.py +++ b/mms/model_server.py @@ -76,7 +76,7 @@ def start(): print("--log-config file not found: {}".format(log_config)) exit(1) - cmd.append("-Dlog4j.configuration=file://{}".format(log_config)) + cmd.append("-Dlog4j.configurationFile=file://{}".format(log_config)) tmp_dir = os.environ.get("TEMP") if tmp_dir: @@ -110,7 +110,7 @@ def start(): arg_list = vm_args.split() if args.log_config: for word in arg_list[:]: - if word.startswith("-Dlog4j.configuration="): + if word.startswith("-Dlog4j.configurationFile="): arg_list.remove(word) cmd.extend(arg_list) plugins = props.get("plugins_path", None) diff --git a/mms/version.py b/mms/version.py index 8128c2789..725d01a60 100644 --- a/mms/version.py +++ b/mms/version.py @@ -11,4 +11,4 @@ This is the current version of MMS """ -__version__ = '1.1.4' +__version__ = '1.1.5'