Oracle Application Server 10g Administrator's Guide 10g (9.0.4) Part Number B10376-01 |
|
printlogs Tool Syntax and Usage
This appendix describes the printlogs
command-line tool. You can use printlogs
to print the contents of Oracle Application Server diagnostic log files to standard output.
It contains the following topics:
The printlogs
command-line tool reads logs generated by Oracle Application Server components and prints the content of the logs to standard output in a common format. printlogs
supports many options for reading and filtering log files, and formatting the output.
See Also:
Chapter 4, "Managing Log Files" for more information on Oracle Application Server logging |
The printlogs
command is located in:
ORACLE_HOME
/diagnostics/bin/printlogs
printlogs
, you must log in as a user that has permission to read all of the log files in your Oracle home, for example, the user that installed Oracle Application Server.
printlogs
operates on the Oracle home it resides in. You can override this with the -home
option. Note that printlogs
does not use the ORACLE_HOME
environment variable.
printlogs
options are not case-sensitive.
printlogs
uses the contents of the directory ORACLE_HOME
/diagnostics/config/registration
to determine which log files to read, the location of log files, and additional configuration information about each log file. You can override this with the -repository
, -registration
, and -logs
options.
Section 4.6.4, "Component Diagnostic Log File Registration" for more information
See Also:
printlogs [input options] [filter options] [output options] [general options]
[-homeoracle_home_path
] [-repository] [-homeoracle_home_path
] [-registrationregistration_directory_path
] [filter options] [output options] [general options] [-logslog_path
[log_path
...]]
[-tailn
] [-lastn
[s|m|h|d]] [-queryexpression
]expression
:
simple_expression
-notsimple_expression
simple_expression
-andsimple_expression
simple_expression
-orsimple_expression
simple_expression
:
field_name
op
value
(expression
)
field_name
:
An ODL log record field name. See Section E.4, "Log Record Fields" for a list of field names.
op
:
-eq | -eq_case | -contains | -contains_case | -startswith | -startswith_case | -from | -to
value
:
A string or timestamp, depending on the operation (op
)
[-odl | -odl_complete | -text | -text_short | -text_full] [-orderByorderByFieldList
] [-count [groupByFieldList
]]
[-help] [-f] [-sleep n
] [-notailopt]
This section provides detailed descriptions of printlogs
options. It contains the following sections:
You can use input options to specify the location of logs and log definitions. The default is the local Oracle home. Table E-1 describes the input options in detail.
Input Option | Description |
---|---|
-home
|
Specify an alternate Oracle home directory from where to read logs and log definitions |
-repository |
Specify that log records should be read from the common repository instead of directly from each log. The common repository is updated by the Log Loader. The Log Loader must be running in order for the repository to contain the contents of Oracle Application Server component logs. |
-repos |
Same as -repository |
-registration
|
Specify an alternate registration directory that contains definitions of log files to be read by |
-logs |
Specify one or more logs to be read by The registration directory is used to find the definition of each log. If one of the specified logs is not defined in the registration directory, it is read by the default "UnformattedTextLogReader".
Note: The |
You can use filter options to define which log records printlogs
should print. The default is to print all records generated in the last 10 minutes. Table E-2 describes the filter options in detail.
Filter Option | Description |
---|---|
-tail
|
Perform an operation similar to the UNIX "tail" command before reading a log. The |
-last
|
Print only logs generated in a specified period of time. The default is 10 minutes.
You can use the
If you would like to search through the logs generated over a large period of time, you can use a large value such as
The value of the |
-query
|
Apply |
Table E-3 describes the query expressions you can use with the -query
filter option in the printlogs
command.
Query Expression Option | Description |
---|---|
() |
You can use parenthesis as delimiters for complex sub-expressions. Parenthesis have special meaning to most UNIX command shells and you must use an escape character with them. This is not necessary on Windows. |
-not |
Logical negation |
-and |
Logical and |
-or |
Logical or |
|
An ODL log record field name. See Section E.4, "Log Record Fields" for a list of available field names. |
-eq |
Equality operation (case-insensitive). You can use this operation with all log record fields. |
-eq_case |
Same as -eq, except case-sensitive |
-contains |
Contains operation (case-insensitive). The result is true only if the log record field value contains the value operand string. You can use this operation only with "string" log record fields (all fields except |
-contains_case |
Same as -contains, except case-sensitive |
-startswith |
Starts with operation (case-insensitive). The result is true only if the log record field value starts with the value operand string. You can use this operation only with "string" log record fields (all fields except |
-startswith_case |
Same as -startswith, except case-sensitive |
-from |
This operation can only be used with timestamped log record fields (
By default, |
-to |
This operation can only be used with timestamped log record fields (TSTZ_ORIGINATING and TSTZ_NORMALIZED). The result is true only if the log record timestamp is less than or equal to the operand value. The operand value must be either in the ISO 8601 time format (for example: 2003-06-30T12:00:00.000-08:00), or in the date/time format of the default Java locale.
By default, |
You can use output options to specify an output format. The default is format is -text_short
. Table E-4 describes the output options in detail.
Output Option | Description |
---|---|
-odl |
Specify that the output should be in ODL format. This option outputs an ODL document without the enclosing LOG tags. The generated output is not a complete XML document. |
-odl_complete |
Specify that the output should be in ODL format and that a complete XML document should be generated |
-text_short |
Specify that the output should be in a short text format including only the following fields: |
-text |
Same as -text_short |
-text_full |
Specify that the output should be in full text format, including all message fields |
-orderBy
|
Sort the result in the specified order. The
|
-count [
|
Report only the record count. The |
You can use general options to obtain help, cause printlogs
to loop, and disable optimization. Table E-5 describes the general options on detail.
General Option | Description |
---|---|
-help |
Print detailed help. |
-f |
Follow. When you use this option, |
-sleep
|
Set the sleep time, in seconds, for the -f option. The default value is 20 seconds. |
-notailopt |
Disable the "tail optimization" that is usually performed with the -last option. |
The printlogs
command automatically translates the contents of any log file that it reads to the Oracle Diagnostic Logging (ODL) format. The ODL log record fields can be used to create a query expression, or to specify a group-by or order-by field list. Each field must be referred to by its names as described in Table E-6. Some of these fields are designated for future use, and currently are not used in any diagnostic messages generated by an Oracle Application Server
You can use an environment variable to pass information to printlogs
. Table E-7 describes the environment variable in detail.
printlogs
printlogs -f
After reaching the end of all log files, printlogs
will go into an infinite loop where it sleeps for 20 seconds, then reads and prints any new records that are added to the log files.
printlogs -repository -last 2h
printlogs -home /private/orahome2 -last 7d -odl
printlogs -last 100d -query TSTZ_ORIGINATING -from 2003-07-15T14:00:00-07:00 -and TSTZ_ORIGINATING -to 2003-07-15T14:05:00-07:00
In this example, we assume that the specified time interval is more than 10 minutes before the current time. By default, printlogs
searches logs generated in the last 10 minutes. We therefore need to use the -last
option to increase the overall search length to include the timestamp interval. To save the trouble of calculating the amount of time to the timestamp interval, you can specify a very large value, such as -last 100d
.
printlogs -last 1d -query \( COMPONENT_ID -eq OC4J -and MODULE_ID -startswith home \)-and MSG_TEXT -contains exception
Note: On the Windows platform the parenthesis should not be escaped.
printlogs -orderBy COMPONENT_ID TSTZ_ORIGINATING:desc
printlogs -count COMPONENT_ID MESSAGE_TYPE
daemon_logs
and dcmctl_logs
:
cd ORACLE_HOME/dcm/logs printlogs -last 1h -logs daemon_logs dcmctl_logs
Note that this example uses log file names relative to the current directory.
ipm.log
and ons.log
:
printlogs -logsORACLE_HOME
/opmn/logs/ipm.logORACLE_HOME
/opmn/logs/ons.log
Note that this example uses the full path to the log files and can be run from any directory.
|
![]() Copyright © 2002, 2003 Oracle Corporation. All Rights Reserved. |
|