Oracle by Example brandingConfigure and Use Log Files

section 0Before You Begin

This 15-minute tutorial shows how to examine log files. The log files are generated by WebLogic Server instances, subsystems, and Java EE applications that run on WebLogic Server or in client JVMs.

Background

This tutorial is part of the Oracle WebLogic Server 12c series, and assumes that you have completed these tutorials, in this order:

WebLogic Server subsystems use logging services to provide information about events. A server instance uses logging services to record events.

Each WebLogic Server instance maintains a server log. WebLogic Server domains typically run multiple WebLogic Server instances, including Administration Server and Managed Server instances. Each WebLogic Server instance has its own log file. The logging server connects messages generated by server instances into a single, domain-wide, message log.

What Do You Need?

  • An installation of Oracle WebLogic Server 12c. See Oracle Fusion Middleware Software Downloads .
  • An instance of WebLogic Server installed in /u01/app/fmw.
  • A properly configured WebLogic Server domain containing an Administration Server and two Managed Servers. This tutorial uses the domain, /u01/domains/ExampleDomain with Managed Servers, server1 and server2.
  • An example application called benefitslog which you can download from here. For this tutorial download the application to the /tmp/download/SampleApp directory.

section 1Locate and View Log Files in the Administration Console

The WebLogic Server Administration Console can be used to view the log file for any server in the domain, regardless of whether the server is located on a remote computer for which you might not have login privileges. In addition, the Administration Console's log file viewer provides filtering tools that you can use to limit the set of messages that it displays. For example, you can use the filtering tools to view only the messages that the subsystem has generated.

To view log messages from the Administration Console:

  1. Ensure that the Administration Server is up and running. Open a web browser and enter the WebLogic Server Administration Console URL:
    http://localhost:7001/console
  2. Log in to the Console using the credentials used when creating the domain.
  3. In the left pane of the Console, expand Diagnostics and select Log Files.
    The log files table lists all of the logs for the domain, including the domain log, server logs, HTTP Access logs and others.
    In this tutorial, we will view the domain log file.
  4. In the Log Files table, select the domain log file and click View.
    The domain log page displays up to 500 messages from most recent to least recent. The messages at the top of the window are the most recent messages that the server has generated.
  5. Select the log record you want to view.
    Domain Log
    Description of the illustration DomainLogFileEntries.png
  6. Click View.
    The log entry details for the selected entry are displayed.

    Domain Log Entry
    Description of the illustration DomainLogEntry.txt

section 1Locate and View Log Files on the File System

You can use a text tool to view messages in the current domain log file as well as older log files that the Administration Server creates per its domain log file rotation scheme.

Domain Log Files

To view domain log files:

Note: This tutorial uses typical Linux commands to view, search, and otherwise examine WebLogic Server log files.

  1. Log on to the computer that hosts the Administration Server. Open a terminal window and change to the directory that contains the domain log file. For example:
    $ cd /u01/domains/ExampleDomain/servers/AdminServer/logs
  2. List the contents of the logs folder to view the log files in the domain.
    $ ls -l
    total 1588
    -rw-r-----. 1 oracle dba     340 Oct 3 04:30 access.log
    -rw-r-----. 1 oracle dba  340632 Oct 4 00:10 AdminServer.log
    drwxr-x---. 2 oracle dba    4096 Oct 3 03:12 diagnostic_images
    -rw-r-----. 1 oracle dba  438127 Oct 4 00:10 ExampleDomain.log
  3. Search the AdminServer.log file for the word listening using grep.
    Note: In this tutorial, use the word listening as an example to search the AdminServer.log file.
    $grep [Ll]isten file.txt searches the file named file.txt for any lines containing upper or lower case L and followed by 'isten'.
    $ grep -i listening AdminServer.log
    ...
    ...
    ####<Oct 3, 2018 3:12:31,634 AM PDT> <Notice> <Server> <localhost> 
    <AdminServer> <weblogic.socket.ServerListenThread> <<WLS Kernel>> 
    <> <20bd7f9b-0053-464a-8c9c-a8ce03b7e222-0000000d> <1538561551634> <[severity-value: 32] 
    [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-002613> <Channel "Default" is now 
    listening on 192.0.2.254:7001 for protocols iiop, t3, ldap, snmp, http.> 

Server Log Files

Server log files record information about server specific events such as the startup and shutdown of servers, the deployment of new applications, or the failure of one or more subsystems. Log messages include information such as date, time, event as well as other information about the specific event.

The server log file is located on the computer that hosts the server instance. Each server instance has its own server log file. The server log file is located in the logs directory under the server instance root directory.

In addition to writing messages to log files, a WebLogic Server instance can print a subset of its messages to standard out. Usually, standard out is the shell (command prompt) in which you are running the server instance. However, some operating systems enable you to redirect standard out to some other location. If you use the Node Manager to start a Managed Server, the Node Manager redirects a server's standard out to a file on the Node Manager's host computer. All messages with severity WARNING or higher are printed to standard out.

To view the log files for the Managed Server, server1:

  1. In a terminal window, change to the directory that contains the server log files for server1 and list the contents:
    $ cd /u01/domains/ExampleDomain/servers/server1/logs
    $ ls -l
    total 3116
    -rw-r-----. 1 oracle dba    1791 Oct  3 22:36 access.log
    drwxr-x---. 2 oracle dba    4096 Oct  3 22:11 diagnostic_images
    -rw-r-----. 1 oracle dba 2972983 Oct  4 01:10 server1.log
    -rw-r-----. 1 oracle dba   18405 Oct  4 00:20 server1.out
    -rw-r-----. 1 oracle dba  138841 Oct  4 00:25 server1.out00001
    -rw-r-----. 1 oracle dba   18133 Oct  4 05:10 server1.out00002
    -rw-r-----. 1 oracle dba   18133 Oct  4 07:48 server1.out00003
    
    Note: The server1.out file is the active server out file. Files with the name server1.out0000x are archived log files. You can configure the max file size and max directory size of archived log files.
  2. Examine the content of the server1.log file, using less.
    Note: less is a linux utilty for listing files. It supports displaying files by pages, searching forward, backward and a host of other capabilities.
    $ less server1.log
    ####<Oct 3, 2018 10:36:09,481 PM PDT> <Info> <Security> <localhost> <> <main> <> <> <> <1538631369481> <[severity-value: 64] [partition-id: 0] [partition-name: DOMAIN] > <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.>
    ####<Oct 3, 2018 10:36:09,620 PM PDT> <Info> <Security> <localhost> <> <main> <> <> <> <1538631369620> <[severity-value: 64] [partition-id: 0] [partition-name: DOMAIN] > <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG128 to HMACDRBG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.>
  3. Note: Navigate through the log file using:

    [Shift] [<] [enter](Move to the beginning of the file)

    [Shift] [>] [enter] (Move to the end of the file)

    / Address [enter](to find the first instance of the word 'Address' in the file)

    / [enter] (Find next instance of previously selected string

HTTP Access Log File

The server log messages and log file communicate events and conditions that affect the operation of the server or the application. Some subsystems maintain additional log files to provide an audit of the subsystem's interactions under normal operating conditions. The HTTP subsystem keeps a log of all HTTP transactions in a text file. The default location and rotation policy for HTTP access logs is the same as the server log. You can set the attributes that define the behavior of HTTP access logs for each server or for each virtual host that you define.

To locate and view the HTTP access log file:

  1. In a terminal window, change to the directory that contains the server log files for server1 and list the contents:
    $ cd /u01/domains/ExampleDomain/servers/server1/logs
    $ ls -l
    total 3116
    -rw-r-----. 1 oracle dba         1791 Oct  3 02:28 access.log
    drwxr-x---. 2 oracle dba         4096 Oct  3 03:05 diagnostic_images
    -rw-r-----. 1 oracle dba         2972983 Oct 4 06:01 server1.log
    -rw-r-----. 1 oracle dba         18405 Oct 3 07:32 server1.out
    -rw-r-----. 1 oracle dba         138841 Oct 4 00:25 server1.out00001
    -rw-r-----. 1 oracle dba         18133 Oct 4  05:10 server1.out00002
    -rw-r-----. 1 oracle dba         18133 Oct 4  07:48 server1.out00003
    
  2. Examine the content of the access.log file, using less.
    $ less access.log
    ...
    ...
    198.51.100.10 - - [05/Oct/2018:02:51:37 -0700] "GET /benefitslog HTTP/1.1" 302 291
    198.51.100.10 - - [05/Oct/2018:02:51:38 -0700] "GET /benefitslog/welcome.html HTTP/1.1" 200 1640
    198.51.100.10 - - [05/Oct/2018:02:51:38 -0700] "GET /benefitslog/css/styles.css HTTP/1.1" 200 532
    198.51.100.10 - - [05/Oct/2018:02:51:38 -0700] "GET /favicon.ico HTTP/1.1" 404 1164
  3. Examine the content of the access.log file, using grep.
    $ grep 192.0.2.25 access.log
    ...
    ...
    192.0.2.25 - - [05/Oct/2018:02:53:32 -0700] "POST /benefitslog/benefitsservlet HTTP/1.1" 200 711
    192.0.2.25 - - [05/Oct/2018:02:53:43 -0700] "GET /benefitslog/welcome.html HTTP/1.1" 200 1640
    192.0.2.25 - - [05/Oct/2018:02:54:40 -0700] "POST /benefitslog/benefitsservlet HTTP/1.1" 200 366
    
    

section 1Deploy a Sample Application for Logging

Many administration operations lead to log messages being generated. Deploying an application, as well as the application itself, can result in new log messages being generated.

To deploy a sample application for logging:

  1. Download the benefitslog sample application to the machine where your domain's Administration Server is located. This is a sample Java web application archive to deploy.
  2. Log in to the Administration Console.
  3. In the Change Center, click Lock & Edit.
  4. Under Domain Structure, select Deployments, and then click Install.
  5. Locate the downloaded archive file.
    1. To the right of Current Location, click the links to browse to the location where you placed the downloaded benefitslog.war file.
    2. Select the benefitslog.war file. The Console fills in the Path field for you. Alternatively, enter the path and the file name in the Path field.
    3. Click Next.
  6. On the Install Application Assistant page, select Install this deployment as an application, and then click Next.
  7. In the Targets table, select server1 and server2, and then click Next.
  8. On the Optional Settings page, keep all the default values and click Next.
  9. On the review page, select No, I will review the configuration later, and then click Finish.
  10. To activate the changes, click Activate Changes in the Change Center.
  11. Under Summary of Deployments, select Control.
  12. Select the benefitslog application, click Start and then select Servicing all requests.
  13. Click Yes to continue. After successful activation of the start request, the state of the benefitslog application changes to Active. This indicates that the application is available to those who have access to the server.

View the Log Messages Created by the Sample Application

To view the log messages created by the sample application:

  1. Open a terminal window and change to the directory that contains the server log files for server1:
    $ cd /u01/domains/ExampleDomain/servers/server1/logs
  2. Monitor the server1 log file using the tail command.
    $ tail -f -n 5 server1.log 
    ...
    ...
    ####<Oct 15, 2018 5:02:50,488 AM PDT> <Info> <WorkManager> <localhost> <server1> <Timer-2> <<WLS Kernel>> <> <230207f2-4ca8-4d07-b20c-1c5c7c941023-00000010> <1539604970488> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-002959> <Self-tuning thread pool contains 0 running threads, 1 idle threads, and 6 standby threads>
    ####<Oct 15, 2018 5:04:50,494 AM PDT> <Info> <WorkManager> <localhost> <server1> <Timer-2> <<WLS Kernel>> <> <230207f2-4ca8-4d07-b20c-1c5c7c941023-00000010> <1539605090494> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-002959> <Self-tuning thread pool contains 0 running threads, 1 idle threads, and 6 standby threads>
    ####<Oct 15, 2018 5:06:50,501 AM PDT> <Info> <WorkManager> <localhost> <server1> <Timer-2> <<WLS Kernel>> <> <230207f2-4ca8-4d07-b20c-1c5c7c941023-00000010> <1539605210501> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-002959> <Self-tuning thread pool contains 0 running threads, 1 idle threads, and 6 standby threads>
    ####<Oct 15, 2018 5:08:50,511 AM PDT> <Info> <WorkManager> <localhost> <server1> <Timer-2> <<WLS Kernel>> <> <230207f2-4ca8-4d07-b20c-1c5c7c941023-00000010> <1539605330511> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-002959> <Self-tuning thread pool contains 0 running threads, 1 idle threads, and 6 standby threads>
    ####<Oct 15, 2018 5:10:50,521 AM PDT> <Info> <WorkManager> <localhost> <server1> <Timer-2> <<WLS Kernel>> <> <230207f2-4ca8-4d07-b20c-1c5c7c941023-00000010> <1539605450521> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-002959> <Self-tuning thread pool contains 0 running threads, 1 idle threads, and 6 standby threads>
    
    
  3. Access the benefitslog application using the URL:
    http://localhost:7003/benefitslog
  4. Select all the options on the application welcome page and click Get Information.
  5. Back in the terminal window, view the log messages:
    
    ...
    ...
    ####<Oct 15, 2018 5:26:11,762 AM PDT> <Info> <ServletContext-/benefitslog> <localhost> <server1> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <230207f2-4ca8-4d07-b20c-1c5c7c941023-00000012> <1539606371762> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-000000> <benefits log - benefits servlet>
    ####<Oct 15, 2018 5:26:11,893 AM PDT> <Info> <ServletContext-/benefitslog> <localhost> <server1> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <230207f2-4ca8-4d07-b20c-1c5c7c941023-00000012> <1539606371893> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-000000> <benefits log - company>
    ####<Oct 15, 2018 5:26:11,911 AM PDT> <Info> <ServletContext-/benefitslog> <localhost> <server1> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <230207f2-4ca8-4d07-b20c-1c5c7c941023-00000012> <1539606371911> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-000000> <benefits log - health>
    ####<Oct 15, 2018 5:26:11,914 AM PDT> <Info> <ServletContext-/benefitslog> <localhost> <server1> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <230207f2-4ca8-4d07-b20c-1c5c7c941023-00000012> <1539606371914> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-000000> <benefits log - vision>
    ####<Oct 15, 2018 5:26:11,917 AM PDT> <Info> <ServletContext-/benefitslog> <localhost> <server1> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <230207f2-4ca8-4d07-b20c-1c5c7c941023-00000012> <1539606371917> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-000000> <benefits log - dental>
    
    For more information on grep, less, or tail commands, refer to the linux documentation.

next stepNext Steps

The WebLogic Server 12c collection contains a number of additional tutorials, covering a variety of topics. See the WebLogic Server 12c collection here for additional topics and content.