Documentation Center

Configuring multiple log files

To roll back log files in Management > Administration > System Logs, you need to configure different log files for the ws-api, ws-legacy, and ws components. Otherwise, a single log file might become too large and difficult to roll back.

Procedure

  1. In the WS_CONFIG folder, open the general.properties file with a text editor and configure the common properties related to logging.
    For example:
    log4j.rootCategory=warn, CONSOLE, logfile
    log4j.appender.logfile=org.apache.log4j.RollingFileAppender
    log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
    log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
    log4j.appender.CONSOLE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p - %m%n
    log4j.appender.logfile.MaxFileSize=50MB
    log4j.appender.logfile.MaxBackupIndex=10
    log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
    log4j.appender.logfile.layout.ConversionPattern=[%d] %p %t %c: %m%n
  2. Go to the WS_CONFIG/ws-legacy folder and open the general.properties file with a text editor.
  3. Search for the log4j.appender.logfile.File property. If it is not already there, add it.
    Specify the name and the path of the log file that you want to use for ws-legacy as its value.
    For example:
    log4j.appender.logfile.File=<drive>:/<file path>/ws_legacy.log
    , where <drive> and <file path> are the drive and the exact path where you want the log file to be stored.
  4. Go to the WS_CONFIG/ws-api folder and open the general.properties file with a text editor.
  5. Search for the log4j.appender.logfile.File property. If it is not already there, add it.
    Specify the name and the path of the log file that you want to use for ws-api as its value.
    For example:
    log4j.appender.logfile.File=<drive>:/<file path>/ws_api.log
    , where <drive> and <file path> are the drive and the exact path where you want the log file to be stored.
  6. Go to the WS_CONFIG/ws folder and open the general.properties file with a text editor.
  7. Search for the log4j.appender.logfile.File property. If it is not already there, add it.
    Specify the name and the path of the log file that you want to use for ws as its value.
    For example:
    log4j.appender.logfile.File=<drive>:/<file path>/ws.log
    , where <drive> and <file path> are the drive and the exact path where you want the log file to be stored.
  8. Restart WorldServer.
  9. Optional: Roll back the log files that you have just configured.
    • For ws-legacy: In WorldServer, go to Management > Administration > System Logs and click the roll log icon next to the ws-legacy log file.
    • For ws-api: Obtain an admin token and enter the following in your browser's address bar: http://<ws-host>:<port>/ws-api/v1/wsgate/rollLogFile?appenderName=logfile&token=<admin token>.

      Your ws-api log file is rolled back successfully if true is displayed.

    • For ws: Obtain an admin token and enter the following in your browser's address bar: http://<ws-host>:<port>/ws/wsgate/rollLogFile?appenderName=logfile&token=<admin token>.

      Your ws log file is rolled back successfully if true is displayed.