In a default WebLogic Domain you can have various WebLogic logfiles located at different locations. For administrators it can be hard to find them all and these log files can have and grow to a large file size which can lead to a full file system. In this blogpost we will move these log files to one location.
For example when we take a look at the logs folder of the AdminServer you will see off course the WebLogic server log called AdminServer.log , the domain log in this case base_domain.log, access.log for the HTTP request logging and the FMW log called AdminServer-diagnostic.log.
At a managed server logs folder location you can also see the server1.out and server1.out00001 log files. These files are created by the NodeManager when we start the Managed servers from the WebLogic Console.
First let's move the Domain log.
Then change the General log file for all the WebLogic Servers.
Also do this for the HTTP access.log and rename the logfile to servername_access.log else it will conflict with the other servers.
To control the NodeManager standard and error output of the Managed Servers you need set the following weblogic.Stdout weblogic.Stderr parameters. Add these parameters to the argument field of all the managed server which will be started by the NodeManager.
When you enable at least the JRF or the Enterprise Manager option on your domain you need to change the location of the FMW log files. Go the Enterprise Manager Application and select all the Managed Servers.
Click on odl-handler and press the Edit Configuration.
Change the path of the log file.
Now you have one location which contains all the log files.
Psst..
ReplyDelete---------
connect('weblogic','secret_password','t3://localhost:7001')
edit()
startEdit()
svrs = adminHome.getMBeansByType('Server')
for s in svrs:
name = s.getName()
cd('/Servers/' + name + '/Log/' + name)
cmo.setRotationType('byTime')
cmo.setRotationTime('00:00')
cmo.setFileTimeSpan(24)
cmo.setFileCount(30)
cmo.setNumberOfFilesLimited(true)
cmo.setRotateLogOnStartup(true)
cmo.setDomainLogBroadcastSeverity('Warning')
cmo.setMemoryBufferSeverity('Warning')
cmo.setLogFileSeverity('Warning')
cmo.setStdoutSeverity('Warning')
activate()
disconnect()
---------
:)
Hi Jacco,
DeleteDo you know if it's possible to set these same values (FileCount, RotationType, etc.) as arguments in the Server Start tab > Arguments field of the Managed Server?
For some reason, after adding those two arguments to my Managed Server start (-Dweblogic.stdout and -Dweblogic.stderr, pointing them to my .log), I lost control of this log file, that I used to control using the WebLogic console itself (Managed Server > Logging > General).
Any idea?
Best regards,
Daniel.
Thanks Jacco.
ReplyDeletealways handy.
Hi,
ReplyDeleteHow to get this weblogic configuration page?
Or... use ListLogHandlers() & ConfigureLogHandler() in WLST to change ODL logpath
ReplyDeleteFilling up your filesystems won't happen if you set a retentionperiod and max files to rotate
Hi,
ReplyDeletethanks for this good overwiew.
There is one thing missing. Every Admin always asks: Where/How to control the rotation policy of the server1.out and server1.out00001 (if MSs started by NodeManager)
Is it possible?
Hi,
ReplyDeleteThat is not possible, you can only shrink it and need to put this in a schedular / cron
By default Weblogic wont have options to rotate the *.out file, If you are running in unix or Linux boxes, you can add the following snippet
under /etc/logrotate.conf file append a function to handle *.out files
<>/*.out {
copytruncate
rotate
size=20Mb
}
Hi Edwin,
DeleteHow can we rotate *.out log file at windows platform.
Hi Edwin,
DeleteAs suggested in the above comment i have added the below snippet in /etc/logrotate.conf
(location of logs directory)/*.out {
copytruncate
rotate 5
size=10M
}
This Script works fine till the rotation, but after .out file is rotated server is not able to write to the .out it is remaining at the size 0KB.
Can you please let me know if there is any way to avoid this?
Thank you in advance!!!
-Vishnu
hi Edwin
ReplyDeleteIs there any way to access the logs of the weblogic server programatically.
I want to access the logs of a weblogic server using java class but have to idea how to do it..
please help
Hi,
DeleteI don't saw a mbean which can do this for you. So I don't think so
Thanks
is there a way to delete .out and .log files in the future(means we have got .log and .out file today and tomo if we wish to remove the yesterday generated files).Is this option possible.
ReplyDeleteand that should has to be using program. is that possible.. please help
Hi,
Delete.out are generated by the nodemanager and this does not support rotating files. On unix you have some options like in this blogpost
http://robin4444.blogspot.nl/2011/11/rotate-out-log-files.html
with unix scripting and contrab you should come far.
thanks
Hi Edwin,
ReplyDeleteThis is really nice blog, I got useful information but in my domain under adminserve/log directory I could see one more log file -gc.log.
In server start property nothing is given, I don't know from where this file is getting generated, I want to move this file lcoation as well.
Regards..
Manish
Hello Edwin!
ReplyDeleteAs always, nice article! Question, is it possible to change diagnostic-logging rotation strategy outside the Enterprise Manager? I mean, using Weblogic console.
Thanks in advance,
Renan.
Hi,
Deleteonly with EM and with WLST and you need to use the wlst.sh of the oracle_common home.
here you got the script
https://raw.github.com/biemond/puppet/master/modules/wls/templates/wlst/changeFMWLogFolder.py.erb
thanks
Thanks for the blog. It is helpful.....
ReplyDeleteThanks for the post ! Once again, a very useful message.
ReplyDeleteMaybe a bit "out of the scope" but, is there a way to split the managed server's log into 2 files, one containing ERROR and INCIDENT_ERROR logs and the other containing the rest of the logs ? Or, at least, is there a way to isolate in a file ERROR and INCIDENT_ERROR logs even if they are also in the "normal" log ?
Thanks
Hi,
Deletewith the FMW ( odl ) log configuration you can do what you want.
maybe this can help
http://docs.oracle.com/cd/E23943_01/core.1111/e10105/logs.htm#CHDDEEBF
Thanks
Hi,
ReplyDeleteI have deployed my adf application on weblogic 10.3.5 instance.
In my code, i have mentioned to generate log statements "application.log" file in log4l.xml.
But unfortunately, log statements are generated in "portalNodeName.out" file.
Could you please help me out?
Hi,
ReplyDeleteI have deployed my adf application on weblogic 10.3.5 instance.
In my code, i have mentioned to generate log statements "application.log" file in log4l.xml.
But unfortunately, log statements are generated in "portalNodeName.out" file.
Could you please help me out?