Wednesday, November 30, 2011

Rotate .out log files

1) If you are using nodemanager you can redirect .out to .log and control them via console (server -> logging tab under console)
traverse to */user_projects/domains/base_domain/bin/nodemanager
take a backup of wlscontrol.sh and edit it
change OutFile=$ServerDir/logs/$ServerName.out to OutFile=$ServerDir/logs/$ServerName.log

ELSE

2) You can make changes to the OS parameters under /etc/logrotate.conf
add the below lines at the end of the file

<Location of logs directory>/*.out
{
copytruncate
rotate 4
size=20Mb
}

ELSE

3)Add the flag  -Dweblogic.log.RedirectStdoutToServerLogEnabled=true to redirect .out to .log and control them via console (server -> logging tab under console)
and if you are starting via nodemanager add below additional parameters
nodemanager.properties under */wlserver_10.3/common/nodemanager
StartScriptName=startWebLogic.cmd
StartScriptEnabled=true

ELSE

4)Use OS command "logrotate" (via cron) to achieve your target. You can combine it with copytruncate to rotate logs.
http://linuxcommand.org/man_pages/logrotate8.html

4 comments:

Anon said...

I tried the third option which seemed to be the easy one 3)Add the flag -Dweblogic.log.RedirectStdoutToServerLogEnabled=true to redirect .out to .log and control them via console.

the .out file is still updating. So going with the first option now.

David Hergert said...

Did you have better luck with the other option? And do you know why the first option didn't work?

Narasimhulu M said...

hi What is the difference between servername.log servername.out log files.
which information will contains both files? suppose i want check application related errors which file i want check?

Anonymous said...

I have combined steps 1 and 3 and it's working just fine.