[WLS8]Redirecting Standard Out and Standard Error to a File [Windows]
작성자Luke작성시간08.05.06조회수486 목록 댓글 0서비스로 웹로직을 구동시킬때 Stdout 과 Stderr 를 파일로 보내기
기본적으로 웹로직 인스턴스를 윈도우즈 서비스로 설치하게 되면 JVM의 standard out 과 error를 볼 수 없게 된다.
이 메시지를 보기 위해서는 standard out 과 error 를 파일로 리다이렉션 시켜야만 한다.
1. WL_HOME\server\bin\installSvc.cmd 스크립트를 백업 받아 놓는다.
2. WL_HOME\server\bin\installSvc.cmd 파일을 편집기로 연다.
3. installSvc.cmd 의 제일 마지막 항목이 beasvc 를 실행하는 스크립트인데, 이 커맨드의 마지막에 아래 내용을 추가한다.
-log:"pathname "
pathname 에 standard out 과 standard error 메시지를 저장할 파일의 절대경로와 파일명을 넣도록 한다.
"%WL_HOME%\server\bin\beasvc" -install
-svcname:"%DOMAIN_NAME%_%SERVER_NAME%"
-javahome:"%JAVA_HOME%" -execdir:"%USERDOMAIN_HOME%"
-extrapath:"%WL_HOME%\server\bin" -password:"%WLS_PW%"
-cmdline:%CMDLINE%
-log:"d:\bea\user_projects\domains\myWLSdomain\myWLSserver-stdout.txt”
4. By default, every 24 hours the Windows service archives messages to a file named
pathname-yyyy_mm_dd-hh_mm_ss. New messages collect in the file that you specified in
the previous step.
For information on changing the default behavior, see “Changing the Default Rotation
Criteria” on page 6-13.
After you install the service and restart the Windows host, to view the messages that the server
writes to standard out or standard error, do one of the following: Make a copy of the file that you specified and view the copy. The Windows file system
cannot write to files that are currently opened.
To view the messages as they are being printed to the file, open a command prompt and,
using a DOS utility that supports the tail command, enter tail -f stdout-filename.
Setting Up a Windows Service: Main Steps
Configuring and Managing WebLogic Server 6-13
Changing the Default Rotation Criteria
By default, every 24 hours the Windows service archives messages to a file named
pathname-yyyy_mm_dd-hh_mm_ss. New messages collect in the file that you specified when
you set up the service.
You can change the time interval or you can set up rotation to occur based on the size of the
message file instead of a time interval.
To change the default criteria at which the Windows service rotates message files:
1. If the Windows service is running, shut it down.
2. Edit the file you specified in the -log: pathname argument. If a file does not exist, create
one.
For example, if you issued the example command in step 3. in the previous section, create
a file named d:\bea\wlserver6.1\config\mydomain\myserver-stdout.txt.
3. Do one of the following:
– If you want the Windows service to rotate the message file at a specific time interval
regardless of file size, add the following statements at the top of the file, each statement
on a separate line (make sure to press the Enter or Return key after typing the last line):
# ROTATION_TYPE = TIME
# TIME_START_DATE = date-in-required-format
# TIME_INTERVAL_MINS = number-of-minutes
where TIME_START_DATE specifies when the first rotation should take place. If the
specified time has already passed, the first rotation occurs when the time interval
specified in TIME_INTERVAL_MINS expires. You must use the following format to
specify the start time: Month Day Year Hour:Minutes:Seconds
where Month is the first 3 letters of a Gregorian-calendar month as written in English
Day is the 2-digit day of the Gregorian-calendar month
Year is the 4-digit year of the Gregorian calendar
Hour:Minutes:Seconds expresses time in a 24-hour format
and TIME_INTERVAL_MINS specifies how frequently (in minutes) the Windows service
rotates the file.
For example:
# ROTATION_TYPE = TIME
# TIME_START_DATE = Jul 17 2003 05:25:30
# TIME_INTERVAL_MINS = 1440
Setting Up a WebLogic Server Instance as a Windows Service
6-14 Configuring and Managing WebLogic Server
When the time interval expires, the Windows service saves the file as
pathname-yyyy_mm_dd-hh_mm_ss. It then creates a new file named pathname. This
new file, which contains all of the headers that you specified originally, collects new
standard out and standard error messages.
If you specify # ROTATION_TYPE = TIME but do not include the other lines, the
Windows service rotates the message file every 24 hours.
– If you want the Windows service to rotate the message file after the file grows beyond
a specified size, add the following statements at the top of the file, each statement on its
own line (make sure to press the Enter or Return key after typing the last line):
# ROTATION_TYPE = SIZE
# SIZE_KB = file-size-in-kilobytes
# SIZE_TRIGGER_INTERVAL_MINS = polling-interval
where SIZE_KB specifies the minimal file size (in kilobytes) that triggers the Windows
service to move messages to a separate file.
and SIZE_TRIGGER_INTERVAL_MINS specifies (in minutes) how frequently the
Windows service checks the file size. If you do not include this header, the Windows
service checks the file size every 5 minutes.
For example:
# ROTATION_TYPE = SIZE
# SIZE_KB = 1024
# SIZE_TRIGGER_INTERVAL_MINS = 3
When the Windows service checks the file size, if the file is larger than the size you
specify, it saves the file as pathname-yyyy_mm_dd-hh_mm_ss. It then creates a new
file named pathname. This new file, which contains all of the headers that you
specified originally, collects new standard out and standard error messages.
If you specify # ROTATION_TYPE = SIZE but do not include the other lines, the
Windows Service checks the size of the message file every 5 minutes. If the file is
larger than 1 megabytes, it rotates the file.
To cause the WebLogic Server instance to print a thread dump to standard out, do either of the
following:
Use the weblogic.Admin THREAD_DUMP command. For more information, refer to
"THREAD_DUMP" in the WebLogic Server Command Reference.
Open a command prompt and enter the following command:
Setting Up a Windows Service: Main Steps
Configuring and Managing WebLogic Server 6-15
WL_HOME\bin\beasvc -dump -svcname:service-name
where WL_HOME is the directory in which you installed WebLogic Server and
service-name is the Windows service that is running a server instance.
For example:
D:\bea\weblogic81\server\bin\beasvc -dump -svcname:mydomain_myserver