Pages

Tuesday, July 5, 2011

Change the log files location of a WebLogic Domain

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.

21 comments:

  1. Psst..
    ---------
    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()


    ---------
    :)

    ReplyDelete
    Replies
    1. Hi Jacco,

      Do 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.

      Delete
  2. Hi,
    How to get this weblogic configuration page?

    ReplyDelete
  3. Or... use ListLogHandlers() & ConfigureLogHandler() in WLST to change ODL logpath
    Filling up your filesystems won't happen if you set a retentionperiod and max files to rotate

    ReplyDelete
  4. Hi,

    thanks 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?

    ReplyDelete
  5. Hi,

    That 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
    }

    ReplyDelete
    Replies
    1. Hi Edwin,
      How can we rotate *.out log file at windows platform.

      Delete
    2. Hi Edwin,

      As 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

      Delete
  6. hi Edwin

    Is 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

    ReplyDelete
    Replies
    1. Hi,

      I don't saw a mbean which can do this for you. So I don't think so

      Thanks

      Delete
  7. 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.
    and that should has to be using program. is that possible.. please help

    ReplyDelete
    Replies
    1. Hi,

      .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

      Delete
  8. Hi Edwin,

    This 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

    ReplyDelete
  9. Hello Edwin!

    As 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.

    ReplyDelete
    Replies
    1. Hi,

      only 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

      Delete
  10. Thanks for the blog. It is helpful.....

    ReplyDelete
  11. Thanks for the post ! Once again, a very useful message.
    Maybe 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

    ReplyDelete
    Replies
    1. Hi,

      with 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

      Delete
  12. Hi,

    I 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?

    ReplyDelete
  13. Hi,

    I 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?

    ReplyDelete