Sun Java System Web Server 7.0 Update 4 Administrator's Guide

Setting Up Logging for Your Server

The Administration Server log files record data about the server, including the types of errors encountered and information about server access. Viewing these logs enables you to monitor server activity and troubleshoot problems by providing data like the type of error encountered and the time certain files were accessed.

You can specify the type and format of the data recorded in the administration server logs using the Log Preferences page from the administration console. For instance, you can choose to log data about every client who accesses the administration server or you can omit certain clients from the log. In addition, you can choose the Common Log Format, which provides a fixed amount of information about the server, or you can create a custom log file format that better suits your requirements.

Types of Log

The log type can be broadly classified as:

  1. Access Log — The access log records information about requests to and responses from the server.

  2. Server Log — The Server Log lists all the errors the server has encountered since the log file was created. It also contains informational messages about the server, such as when the server was started and who tried unsuccessfully to log in to the server.

Viewing Access and Server Logs

In the preceding commands, the start-date and the end-date options must be in the following format — dd/MM/yyyy:HH:mm:ss. The date format can also be customized. You can use a variable wadm_log_date_format in the rcfile to specify your own date format rather than using the default date format.

In the Sun Java System Web Server, you can enable access log by executing the following command:

enable-access-log --user=admin --host=serverhost --password-file=../admin.passwd --port=8989 --ssl=true --no-prompt --rcfile=null --config=config1 --vs=vs --uri-pattern="*.html" --file=../logs/ --log-ip=true--format="%Req->reqpb. protocol% %Req->headers.authorization% %vsid% %Ses->client.dns%"

Configuring Log Parameters

To enable and edit log settings for a configuration, perform the following tasks:

  1. Click theConfiguration tab.

  2. Select the configuration for which you will need to enable/edit log settings.

  3. Click the General Settings > Log Settings tab.

Editing Access Log Preferences

The fields in the Access Log Preferences section are described in the following table:

Table 13–5 Field Description > Editing Access Log Preferences



Access Log

Enabled/Disabled. By default, access log is enabled. Select this option to disable access log. Note that enabling access log will degrade server performance at a very low magnitude.

File Location

The server path, where the access log files will be stored. Default values is ../logs/access

Log Format

  1. Use Common Log Format — This option is the default format type for the log file. The server will log most relevant information extracted from the request headers.

    Common log format is IP address — user [date] “request” status content-length.

  2. Log these details only — You can log only specific values from the request header using this option. Select one of the following values:

    • Client Hostname

    • System Date

    • HTTP Status

    • HTTP Header

    • HTTP Method

    • Query String

    • Virtual Server Name

    • Authenticated User Name

    • Complete HTTP Request

    • Content Length

    • Request URI

    • Protocol

Editing Server Log Preferences

The fields in the Server Log Preferences section are described in the following table:

Table 13–6 Field Description > Editing Server Log Preferences



Server Log Location

The server path, where the Server Log files will be stored. The default value is ../logs/errors

Log Verbosity Level

This option provides a means of setting log granularity. To test and debug web applications, the recommended level is finest.

For a production environment, the recommended log level is failure or security. catastrophe log level will log very few details.

Log Virtual Server Name

If this option is selected, the name of the virtual server processing the request is logged along with any errors. 

Log to System Log

Logs all messages to the system log. 

Log to console

If this option is selected, exceptions arising from deployed web applications are logged, if they are written to console.

This option is enabled by default. 

Date Format

The time format, which is used to append time stamps to the error messages. The default value is [%d/%b/%Y:%H:%M:%S]

Archiving Log Files

You can set up log files to be automatically archived. At a certain time, or after a specified interval, the server rotates your access logs. The server saves the old log files and marks the saved file with a name that includes the date and time they were saved.

For example, you can set up files to rotate every hour, and the server saves and names the file “access.199907.0152400,” where “name|year|month|day|24-hour time” is concatenated together into a single character string. The exact format of the access log archive file varies depending upon which type of log rotation you set up.

Access log rotation is initialized at server startup. If rotation is turned on, the server creates a time-stamped access log file and rotation starts at server startup.

Once the rotation starts, the server creates a new time stamped access log file when there is a request that needs to be logged to the access log file and it occurs after the previously-scheduled “next rotate time.”

Setting Log Rotation

You can create a schedule for error/access log rotation for the configured instances by using the log rotation option. To set up log rotation, perform the following steps:

  1. Click the Configuration tab.

  2. Select the configuration for which you need to enable/edit log settings.

  3. Click the General Settings > Log Settings tab.

  4. Under Log Archiving, click New.

The fields in the new log rotation page is described in the following section:

Table 13–7 Field Description > Setting Log Rotation




Access Log Rotation / Server Log Rotation. Select any or both of these options to configure rotation for that log type.


The configured time when the event will start. Select the hour and minutes value from the drop-down box. 

Every Day — Starts the event specified every day at the specified time.

Specific Days — Starts the event specified at specific days.

1. Days — Specify any day from Sunday to Saturday.

2. Dates — Specify any day of the month from 1 to 31 as comma separated entries. E.g. 4,23,9

Specific Months — Starts the event specified at the specific time and month. Specify month from January to December.


Start the specified event after this time period. 

1. Every Hours — Select the number of hours from the drop-down box.

2. Every Seconds — Select the number of seconds from the drop-down box.

If you need to delete the scheduled log rotation, Click Delete in the Log Archiving section.

Archive Command

You can specify the absolute path of the command after the server rotates the log file. The post-rotation filename of the log file is passed as an argument to the archive command. The archive command also compresses the log file that has been rotated.