Before 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
andserver2
. - An example application called
benefitslog
which you can download from here. For this tutorial download the application to the/tmp/download/SampleApp
directory.
Locate
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:
- 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
- Log in to the Console using the credentials used when creating the domain.
- 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.
- 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.
- Select the log record you want to view.
Description of the illustration DomainLogFileEntries.png - Click View.
The log entry details for the selected entry are displayed.
Description of the illustration DomainLogEntry.txt
Locate 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.
- 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
- 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
- Search the
AdminServer.log
file for the word listening usinggrep
.Note: In this tutorial, use the word listening as an example to search theAdminServer.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
:
- In a terminal window, change to the directory that
contains the server log files for
server1
and list the contents:$ cd /u01/domains/
Note: The
/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.out00003ExampleDomain
server1.out
file is the active server out file. Files with the nameserver1.out0000x
are archived log files. You can configure the max file size and max directory size of archived log files. - Examine the content of the
server1.log
file, usingless
.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.>
[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:
- 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 oracledba
4096 Oct 3 03:05 diagnostic_images -rw-r-----. 1 oracle
2972983 Oct 4 06:01 server1.log -rw-r-----. 1 oracledba
18405 Oct 3 07:32 server1.out -rw-r-----. 1 oracledba
138841 Oct 4 00:25 server1.out00001 -rw-r-----. 1 oracledba
18133dba
Oct 4
05:10 server1.out00002 -rw-r-----. 1 oracle
18133dba
Oct 4
07:48 server1.out00003 - Examine the content of the
access.log
file, usingless
.$ 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
- Examine the content of the
access.log
file, usinggrep
.$ 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
Deploy 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:
- 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. - Log in to the Administration Console.
- In the Change Center, click Lock & Edit.
- Under Domain Structure, select Deployments, and then click Install.
- Locate the downloaded archive file.
- To the right of Current Location, click the links
to browse to the location where you placed the
downloaded
benefitslog.war
file. - 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. - Click Next.
- To the right of Current Location, click the links
to browse to the location where you placed the
downloaded
- On the Install Application Assistant page, select Install this deployment as an application, and then click Next.
- In the Targets table, select
server1
andserver2
, and then click Next. - On the Optional Settings page, keep all the default values and click Next.
- On the review page, select No, I will review the configuration later, and then click Finish.
- To activate the changes, click Activate Changes in the Change Center.
- Under Summary of Deployments, select Control.
- Select the
benefitslog
application, click Start and then select Servicing all requests. - 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:
- Open a terminal window and change to the directory
that contains the server log files for
server1
:$ cd /u01/domains/ExampleDomain/servers/server1/logs
- Monitor the
server1
log file using thetail
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>
- Access the
benefitslog
application using the URL:http://localhost:7003/benefitslog
- Select all the options on the application welcome page and click Get Information.
- Back in the terminal window, view the log messages:
For more information on... ... ####<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>
grep
,less
, ortail
commands, refer to the linux documentation.
Next
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.